HTML Input Types, Sensors, Random Numbers, and Loops in JavaScript
Classified in Computers
Written on in English with a size of 3.49 KB
Radio Buttons
Radio buttons allow you to choose only one option among multiple. If an option wasn't previously selected, it can be automatically changed. Radio buttons with the same name are grouped together, ensuring that only one option within that group can be selected at a time.
Gender: Male Female
Checkboxes
Checkboxes allow you to choose one or more options from a list. Unlike radio buttons, a name attribute is not required for grouping.
Activities: Yoga Boxing
To check if a checkbox is selected in JavaScript, you can use the following code within a button's function:
if (document.getElementById("checkbox_id").checked == true)
To reset a checkbox, use:
document.getElementById("checkbox_id").checked = false;
Sensors
Senses allow us to collect information... Continue reading "HTML Input Types, Sensors, Random Numbers, and Loops in JavaScript" »