I want to show a confirm dialog when the user selects an item in a DropDownList. If the user presses \"Cancel\", I want to stop the postback. Here is the function I add to the o
You need to return
from that function as well, like this:
$('.warn').change(imitateConfirmUnload);
Currently the return
value isn't being used. This would also work:
$('.warn').change(function() {
return imitateConfirmUnload();
});
Also, I'm pretty sure you want an equals check here:
if (window.onbeforeunload == null)
return true;
Currently it's nulling out the onbeforeunload
handler if it was present.