I have a some textboxes and a drop down.
If the user does not have permission to modify them, I like to
show a message and undo what they selected in teh case of a drop down
or to undo what they types – in the case of a text box.
I tried the following for a drop down but did not work:
$('#ReasonDropDown').change(function () {
if (permission == "False") {
alert("You do not have permssion to make to modify this field.");
event.preventDefault();
return false;
}
});
It simply did not undo what I had selected.
You can try like below and it will works for any number of
selectelement.And also can do similar for
textfields.Demo