JQuery show div when select list is chosen -
i have following jquery script:
$(document).ready(function(){ $("#choices").change(function(){ $("select option:selected").each(function(){ if($("#choices").attr("value")=="a"){ $(".church").show(slow); $(".orginization").hide(slow); } }); }).change(); });
and html:
<select id="choices"> <option value="0">please select</option> <option value="a">church</option> <option valie="b">non-profit</option> <option valie="c">school</option> <option valie="d">commercial</option> <option valie="e">other</option> </select>
when select church list has value "a" should unhide div class "church" can't happen. tell me wrong script.
change code code.
$(document).ready(function(){ $("#choices").change(function(){ var thisval = $(this).val(); if(thisval=="a"){ $(".church").show('slow'); $(".orginization").hide('slow'); } }); });
Comments
Post a Comment