Jump to content

jQuery - show or hide div based on select menu option.


suttercain

Recommended Posts

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>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.