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? Link to comment https://forums.phpfreaks.com/topic/119961-js-event/ 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? Link to comment https://forums.phpfreaks.com/topic/119961-js-event/#findComment-618388 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 Link to comment https://forums.phpfreaks.com/topic/119961-js-event/#findComment-618427 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 Link to comment https://forums.phpfreaks.com/topic/119961-js-event/#findComment-618489 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> Link to comment https://forums.phpfreaks.com/topic/119961-js-event/#findComment-618529 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.