how to select only one checkbox in html

Solutions on MaxInterview for how to select only one checkbox in html by the best coders in the world

showing results for - "how to select only one checkbox in html"
Till
08 Sep 2020
1It's easier to use type='radio' with the same value at 'name' attribute.
2
3The selected value is the value that the 'variable' input_name has.
4
5You can parse the selected value by name. Like: document.getElementsByName('input_name')
6
7<input name='input_name' type='radio'>
8<input name='input_name' type='radio'>
9<input name='input_name' type='radio'>
10<input name='input_name' type='radio'>
11<input name='input_name' type='radio'>