Radio buttons not working in HTML
Please help, I want to fix one of bugs, and here's what you can/can't do with it:
- You can select all options
- When at least one option is selected, it can't be not selected. It'll always "stand" as selected. Try it: https://smartpreview.rixthetyrunt.repl.co/
Halp me
I found a plugin used on a website - https://radiofmluisteren.nl/ that might give you some ideas!
select
tag with option
children:
<select> <option>1</option> <option>2</option> <option>3</option> </select>
I think that to get the data, you have to use select_item.selectedIndex
and that returns an index of the options that shows which one is selected, so select_item.options[select_item.selectedIndex].innerText
is the option which is selected. option
s can be selected and unselected and only one can be selected.
As far as I know, radio buttons are always multiselect and anyway
a dropdown is more appropriate for the situation.
I see what you mean, a better way to do this is to use the
select
tag withoption
children:
Check the answer! I hope that will improve your coding... ( <<:P)
To fix this bug, all of the radio buttons must have the same value of the
name
attribute.Example:
( <<:D) ( Kaomojis look like Tyrunts right now ) It works!