Hi good morning, I want to create a form that has a dropdown menu where users can select an option, and in the option is an ‘other’ option where if a user selects it, an input field will pop up for the user to type in his/her option.
How can that be done with the combination of HTML, CSS and JavaScript?
thats not a short task to fit in an answer on those forums, but i can outline the basics i can think of.
Regarding HTML, there is the select tag, which you can use for a dropdown with several options to choose. Then in JS you should access the select Object, and do certain actions depending if the “other” option is selected or not. You prolly will need to use “onchange” event to attach a handler to the select field. Regarding the input field, where user type his choice, you can create a class which toggles when “other” is selected, that will hide/unhide the choice field, using CSS like display: none.