Hello, I am pretty bad at javascript. Essentially I have a form with a pulldown menu. In the pulldown menu there is a "Other" option. WHat I want to happen when the user selects "other" is for another field to appear next to it and allow them to type in something. Can someone show me an example? I couldn't find one online but I know it is possible.
How is the text box going to be displayed is it just hidden or would you like it to be created in js.
I was using just standard HTML to create the form. <select name="color"> <option value="Other">Other</option> </select> That is how I currently have it setup (minus some css stuff). I Just want a <input type="text" name="other"> to appear if Other is selected in the pull down menu.
<script> function ShowHideTextBox() { if (document.getElementByName("color").value == "Other") { document.getElementById("textboxDiv").style.display = "block"; } else { document.getElementById("textboxDiv").style.display = "none"; } } </script> <select name="color" onclick="ShowHideTextBox()"> <option value="Other">Other</option> </select> <div style="display:none;" id="textboxDiv"> <input name="this_is_the_text_box" /> </div>