Input types | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Input types

Is there any way to deselect a radio input with it alteady being selected? Also is there a way for you to only select on checkboxes if there’s four of them?

4th May 2022, 1:21 AM
Junior
Junior - avatar
8 Answers
+ 1
You could do it with javascript, but... the use of radio buttons is that exactly 1 MUST be selected and the use of checkboxes is that MORE THAN 1 CAN be selected... Can you elaborate why you want to achieve this behavior?
4th May 2022, 12:20 PM
Lisa
Lisa - avatar
+ 1
Maybe something like this: For radio buttons: On click of the item, revert the checked status if it is checked. For checkboxes: On change count the number of checked boxes in the group and set an upper limit. Of the limit is reached, disable unchecked checkboxes until the number is below the limit https://stackoverflow.com/questions/19001844/how-to-limit-the-number-of-selected-checkboxes#19001936
4th May 2022, 12:26 PM
Lisa
Lisa - avatar
0
i was trying to make a quiz game with javascript and i was trying to use the input radio type.
4th May 2022, 12:22 PM
Junior
Junior - avatar
0
And in your quiz, one should select only one item and you want to score "blank" questions differently?
4th May 2022, 12:23 PM
Lisa
Lisa - avatar
0
yes, using javascript, html, and css
4th May 2022, 12:24 PM
Junior
Junior - avatar
0
im not really understanding what they’re saying it seems like they’re using jquery or something else
4th May 2022, 12:29 PM
Junior
Junior - avatar
0
also i did input onclick=“name()”…abd in javascript got the id and checked = false but when i would run it the radio button coudln’t be checked
4th May 2022, 12:31 PM
Junior
Junior - avatar
0
datetime-local month week date time password color file email tel text url
11th Jun 2022, 12:45 AM
aliz6398suisiTerminatorEmpireBot
aliz6398suisiTerminatorEmpireBot - avatar