10.3. Multiple checkboxes and radio boxes

10.3.1. Using multiple checkboxes

Another programming tool to get user input and associated with the HTMLinputElement interface is the checkbox. This is an ideal feature to handle multiple selections on an options list. To control them, or to detect whether the boxes have been checked, you use the property “checked” as defined by the interface in ex10-02.txt. For example, if you have a checkbox defined as

   <input type="checkbox" id="myCheckBox">

you can use the following script statement to check whether the box has been checked:

   document.getElementById("myCheckBox").checked

This statement returns a true value if the box has been checked. Multiple checkboxes can be set up in this way to handle multiple ...

Get Practical Web Technologies now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.