Jquery to reset dropdownlist's selected index is not working
I have a check box and a dropdownlist on my mvc4 razor page
when I uncheck my check box ,i need to reset my dropdownlist's selection to 0
$("#chkProcess").click(function (event) {
//on-click code goes in here.
var chkProcess = $(this);
if (chkProcess.is(':checked')) {
//do process
} else {
$('#locationSelectList').val('0');
alert("" + $("#locationSelectList option:selected").val());
}
});
When I uncheck my checkbox ,I am getting the alert showing selected
Index=0,but on the screen its not actually reflecting the change. But I
need the dropdown to reset the selection on the screen also .Why this
behaviour what am I doing wrong here?
No comments:
Post a Comment