jQuery select change show/hide div event
Use following JQuery. Demo
$(function() {
$('#row_dim').hide();
$('#type').change(function(){
if($('#type').val() == 'parcel') {
$('#row_dim').show();
} else {
$('#row_dim').hide();
}
});
});
Try:
if($("option[value='parcel']").is(":checked"))
$('#row_dim').show();
Or even:
$(function() {
$('#type').change(function(){
$('#row_dim')[ ($("option[value='parcel']").is(":checked"))? "show" : "hide" ]();
});
});
JSFiddle: http://jsfiddle.net/3w5kD/
change your jquery method to
$(function () { /* DOM ready */
$("#type").change(function () {
alert('The option with value ' + $(this).val());
//hide the element you want to hide here with
//("id").attr("display","block"); // to show
//("id").attr("display","none"); // to hide
});
});