plodos Posted October 2, 2011 Share Posted October 2, 2011 Java Script does not work.. What can be the problem ? <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1254"> <title>New Page 1</title> <STYLE TYPE="text/css"> <!-- input{ display:none; } span { display:none; } --> </STYLE> <script type="text/javascript"> <!-- $(function() { $('#sel').change(function() { $("input").hide().filter("." + $(this).find("option:selected").val()).show(); }); $("input").focus(function() { $(this).next("span").fadeIn(1000); }).blur(function() { $(this).next("span").fadeOut(1000); }); }); --> </script> </head> <body> <form> <select id="sel"> <option value="">- select -</option> <option value="option1">Option 1</option> <option value="option2">Option 2</option> <option value="option3">Option 3</option> <option value="option4">Option 4</option> <option value="other">Other</option> </select> <input type="text" class="option1" /><span>Textbox label 1</span> <input type="text" class="option2" /><span>Textbox label 2</span> <input type="text" class="option2" /><span>Textbox label 2</span> <input type="text" class="option2" /><span>Textbox label 2</span> <input type="text" class="option3" /><span>Textbox label 3</span> <input type="text" class="option3" /><span>Textbox label 3</span> <input type="text" class="option4" /><span>Textbox label 4</span> <input type="text" class="other" /><span>Other</span> </form> </body> </html> Link to comment https://forums.phpfreaks.com/topic/248272-display-textbox-on-selection-from-dropdown-list/ Share on other sites More sharing options...
trq Posted October 3, 2011 Share Posted October 3, 2011 You haven't included the jQuery library. On a side note, surrounding your Javascript in HTML comment's hasn't been of any use since the days of Netscape Navigator. Link to comment https://forums.phpfreaks.com/topic/248272-display-textbox-on-selection-from-dropdown-list/#findComment-1275135 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.