I want to disable all links inside an iFrame.
The iFrame is actually the preview frame for the markItUp text editor. I have tried the following based on another Stack Overflow answer but it does not work for me:
$(".markItUpPreviewFrame a").live('click', function(e) {
e.preventDefault;
alert("You twat! This is a preview, where do you think you're going?");
return false;
});
Below is a rough outline of the HTML with the markItUp
iframe:
<div id="markItUpMarkItUp" class="markItUp">
<div class="markItUpContainer">
<div class="markItUpHeader"></div>
<div class="clear"></div>
<textarea id="markItUp" class="markItUpEditor" name="bodyText""></textarea>
<div class="markItUpFooter"></div>
<iframe class="markItUpPreviewFrame">
<html>
<head></head>
<body>
links in here...
<body>
</html>
</iframe>
</div>
When I click on the link, it seems to ignore my jQuery code (I do not get the alert) and loads the page anyway.