Hello guys,I have a question bout radio button.
I can not run this code! I do not know where is wrong! please help me
***<input id='indoor' type='radio' name='indoor-outdoor' >***
*** <label for='indoor'>Indoor</label>***
*** <input id='outdoor' type='radio' name='indoor-outdoor' >***
*** <label for='outdoor'>Outdoor</label>***
<input type="text" placeholder="cat photo URL" required>
I copied your code to jsfiddle and (after deleting all the asterisks) found the radio buttons are working properly. If you check
indoor becomes unchecked, if you check
outdoor becomes unchecked.
What are the buttons doing wrong?
Unfortunately, it does not run in site!
I put error Message for you.
Give your radio buttons the name attribute of indoor-outdoor.
Each of your two radio button elements should be nested in its own label element.
There’s the problem:
So, your structure should look like:
You don’t have each radio button nested in its own
labels are at the same level.