给定以下功能:
window.onbeforeunload= function() {
if (CKEDITOR.instances.stuff.getData().length > 0 && oktoquit == false) {
return "You have unsaved changes. Click Cancel now, then 'Save' to save them. Click OK now to discard them.";
}
};
如果用户单击带有 ID 的 div 中的链接,我想要一种方法来排除此函数的运行:
<div id="ignore me"><a href="">blah</a><a href="">blah</a><a href="">blah</a></div>
有任何想法吗?
** 更新原来是该网站搜索的以下代码导致了问题。但为什么?
$("#searchresults li").live('click', function(e) {
if (e.target.nodeName != "a") {
window.location = $(this).find('a').attr('href');
}
});