How to present checkbox values in HTML (using ejs) after extracting data from mongo for User to Edit?
<p>I currently save data into mongo for a multiple choice question and mark the correct answers, In mongo I save them something like <code></code>question.options.option1.check = "on"
 for the correct answers.</p>

<p>When I go to the "edit" page I pull the particular record from mongo which is available in ejs as "question" and I am easily able to fill the editable fields values as question.question, or question.options.option1.text etc. But I also want to mark the check boxes that have been previously checked. Below is an example of the checkbox. </p>

<pre><code>&lt;input  id=opt1 type="checkbox" name="check1"  &gt;
</code></pre>

<p>when I use    <code>
    &lt;input  id=opt1 type="checkbox" name="check1"      &lt;%=question.options.option1.check%&gt; &gt;</code> it does not work, I also tried <code>&lt;input  id=opt1 type="checkbox" name="check1"  checked="&lt;%=question.options.option1.check%&gt;"&gt;</code> this does not work either. But if I give the attribute "checked" = "any value here or no value at all" it checks, which is wrong.</p>

<p>So the question is what is the correct way to check the appropriate checkboxes on the edit page.?</p>