suttercain Posted June 16, 2010 Share Posted June 16, 2010 Hi everyone, I need to be able to show a new form field based on an option selected in the select menu. The show works fine, but when I select another option the revealed form field (div) won't hide. Any ideas? <script type="text/javascript"> $(document).ready(function(){ $("#parent1").css("display","none"); $("#reveal_add").click(function(){ if ($('option[name=add_mfr]:selected').val() == "add_new" ) { $("#parent1").slideDown("fast"); //Slide Down Effect } else { $("#parent1").slideUp("fast"); //Slide Up Effect } }); }); </script> Link to comment https://forums.phpfreaks.com/topic/204961-jquery-show-or-hide-div-based-on-select-menu-option/ Share on other sites More sharing options...
haku Posted June 17, 2010 Share Posted June 17, 2010 Need to see the HTML for DOM manipulation questions. Link to comment https://forums.phpfreaks.com/topic/204961-jquery-show-or-hide-div-based-on-select-menu-option/#findComment-1073241 Share on other sites More sharing options...
ditsayakul Posted June 22, 2010 Share Posted June 22, 2010 Hi suttercain, Today I need same. long time search engine I found this topic on link http://www.onextrapixel.com/2009/10/13/how-to-display-form-fields-based-on-selection-with-or-without-jquery-cookie/ Link to comment https://forums.phpfreaks.com/topic/204961-jquery-show-or-hide-div-based-on-select-menu-option/#findComment-1075603 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.