Hi Im looking for a way to show hide text box on select option change <select name="letter_type" id="lt"> <option value="Registered">Registered</option> <option selected="selected" value="Unregistered">Unregistered</option></select> <input name="textfield7" id="regty" type="text" accesskey="1" tabindex="1" size="20" /> PHP: i wana show that text box if user select "Registered" from select option. any help would be great sorry for language errors. Thanks
And where is the hide box? Is it <input name="textfield7" id="regty" type="text" accesskey="1" tabindex="1" size="20" />? If yes, is it hide by CSS?
I think this is what you want to do: <select name="letter_type" id="lt"> <option value="Registered">Registered</option> <option selected="selected" value="Unregistered">Unregistered</option> </select> <input name="textfield7" id="regty" type="text" accesskey="1" tabindex="1" size="20" style="display: none; " /> <script type="text/javascript"> var sel = document.getElementById("lt"); var inp = document.getElementById("regty"); sel.onchange = function() { inp.style.display = (sel.value=="Registered")?"block":"none"; } </script> Code (markup):