htmlcheckbox

HTML How to auto select a check box?


I have the following HTML code:

<table border = 0 cellpadding=5 >

<tr>
<td><input type="checkbox" name="all_sizes" value="All">All<br></td>
<td><input type="checkbox" name="10mm" value="10mm">10mm<br></td>
<td><input type="checkbox" name="20mm" value="20mm">20mm<br></td>
<td><input type="checkbox" name="30mm" value="30mm">30mm<br></td>
<td><input type="checkbox" name="40mm" value="40mm">40mm<br></td>
</tr>
</table>

How would we go about selecting the first check box by default?


Solution

  • Change this:

    <td><input type="checkbox" name="all_sizes" value="All">All<br></td>
    

    to this (add the keyword 'checked'):

    <td><input type="checkbox" name="all_sizes" value="All" checked>All<br></td>