abs0lut Posted August 16, 2008 Share Posted August 16, 2008 if I select yes in the dropdown without pressing submit button, it will show an input field is it possible in javascript? could you please help me? Quote Link to comment Share on other sites More sharing options...
RichardRotterdam Posted August 17, 2008 Share Posted August 17, 2008 Uhm can you elaborate that? what do you mean with "yes in the dropdown"? do you mean a confirmbox maybe? What do you mean with "it will show an input field" do you mean you want a input field to be shown inside the form without submitting it? Quote Link to comment Share on other sites More sharing options...
abs0lut Posted August 17, 2008 Author Share Posted August 17, 2008 <option>yes</option> <option>no</option> When I select yes, it will show an input field without pressing submit button Quote Link to comment Share on other sites More sharing options...
RichardRotterdam Posted August 17, 2008 Share Posted August 17, 2008 I'll give you a start <script> function showInput(){ //this is where you should build the input or make it visible } </script> <select onchange="showInput()"> <option>yes</option> <option>no</option> </select> you will still need to write the function but thats part of the fun Quote Link to comment Share on other sites More sharing options...
xenophobia Posted August 17, 2008 Share Posted August 17, 2008 yaya.... a more details of Dj: <script language="JavaScript" type="text/javascript"> function showInput(value) { if(value == "yes") { var new_input = document.createElement("input"); new_input.type = "text"; new_input.name = "txt[]"; document.getElementById("input-container").appendChild(new_input); } } </script> <select onchange="showInput(this.options[this.selectedIndex].value)"> <option value="yes">Yes</option> <option value="no">No</option> </select> <div id="input-container"> <!-- This is where your input box held --> </div> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.