How to make a radiobutton which can write something if i click it? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to make a radiobutton which can write something if i click it?

for example, vehicle: ¤ car ¤ motorcycle ¤ bus ¤ other, _________ so i can fill in the blank if i choose "other"

1st Feb 2017, 6:39 PM
prayoga
prayoga - avatar
1 Answer
+ 3
Give the radio button an id, and the when clicked: if (document.getElementById("rbtn").checked){ document.getElementById("other-text").style.display = visible; } or you could use jQuery to toggle classes, but in theory just hide and show the target element. What you'll make visible is the text area.
1st Feb 2017, 7:06 PM
Mark Foxx
Mark Foxx - avatar