Reputation: 18104
I am writing a plugin to a CMS (umbraco) and I wish to attach a warning dialog to various actions on the page, one such action is clicking a link (JavaScript links), in most browsers the following code works well:
$(".propertypane").delegate("a, a div", "click", function () { window.onbeforeunload = confirmNavigateAway; });
The following is an issue in IE because IE appears to trigger onbeforeunload
event when any link is clicked, even though the link is not navigating away.
I've set up an example here: http://jsfiddle.net/DETTG/8/
Note: I do not have control over the ajax controls within the propertypane
, they're written by third parties.
Upvotes: 6
Views: 2746
Reputation: 11
If you remove "href" then it will work. But then you would need to style it as a link element and add the attribute onclick if you want to execute a function. Here is the updated version: http://jsfiddle.net/DETTG/34/
<a onclick="alert('do some ajax');" style="color:blue; text-decoration:underline; cursor:pointer">javascript</a>
Upvotes: 1