Skip to content Skip to sidebar Skip to footer

Change Drop Down Selected Item Based On Selected Item Of Another Drop Down List

I have two drop down lists on my ASP.NET MVC 3. When one of the drop down lists is set to 'Sole Proprietor', the other needs to be set to the same. I'm sure the JavaScript, or jQue

Solution 1:

jsFiddle example : http://jsfiddle.net/9GZQ2/

I set both dropdown values to "Sole Proprietor" your code has the space missing in the ProducerType select

<scripttype="text/javascript"src="http://code.jquery.com/jquery-1.6.4.js"></script><scripttype="text/javascript">
    $(function(){
        $("#ProducerType").change(function(){
           var value=$(this).val();
           if(value=="Sole Proprietor") $("#Role").val(value);
        });
        $("#Role").change(function(){
           var value=$(this).val();
           if(value=="Sole Proprietor") $("#ProducerType").val(value);
        });
    });
</script>

Post a Comment for "Change Drop Down Selected Item Based On Selected Item Of Another Drop Down List"