Hi all, I think i need JS for the following: I have a form with 2 textfields disabled, now if an user put the right word in textfield3 the other 2 textfields will be enabled. How do i do this??
wrap the first two text boxes in a div tag with the css dispaly set to hidden then create a function in js that compares the value of the third text field create a 'onKeyup' event to call that function function show_text_box(value){ if (value == 'word'){ elem = document.getElementById("hidden"); elem.style.visibility = visible; } } <div id= "hidden" style="visibility:hidden"> <input name="textbox1" type="text" value="" "/> <input name="textbox2" type="text" value="" "/> </div> <input name="textbox3" type="text" value="" onkeyup="show_text_box(document.form.textbox3.value);"/> may need debugging but it will give you an idea
^ yup it needs debugging.. Since I'm bored, let me help out and give a working version. <script> function show_text_box(value){ if (value == 'word'){ elem = document.getElementById("hidden"); elem.style.visibility = 'visible'; } } </script> <div id= "hidden" style="visibility:hidden"> <input name="textbox1" type="text" value="" /> <input name="textbox2" type="text" value="" /> </div> <input name="textbox3" type="text" value="" onkeyup="show_text_box(this.value);"/> HTML: