I was working on one of my websites this week, and needed the ability to allow the user to input some text only when a certain radio button is checked, and make the TextBox go away when another radio button is checked. All the TextBox’s are hidden on page load, then activated when the “Other” radio button is checked. I also use placeholder=”” to give the user some idea of what goes into the box. After a few tries, I got it working and figured, if I needed this, others may as well, and to save you some time and angst, here is my code. Works well in HTML or PHP (just add echo’ … ‘; pieces).
Become the Maker you were born to be. Try Arduino Academy for FREE!
I put together this example that shows how you could accomplish the same thing using css and should help simplify the process for you.
Hope you find this useful,
Good job! Thanks.