English 中文(简体)
马达加斯加 仅限<a>标的(和/或替换)
原标题:DOMSubtreeModified Event (and/or replacement) on solely <a> tags?

我对“DOMSubtreeModised”活动进行了解释(这是令人痛心的消息),但我很想知道,是否有办法在一页上发现每个单角的变化(我知道,这确实可能代价高昂,但目的却是这样)。

Basically, I want to know whenever an <a> tag (node) is created/modified so I can quickly scan its .href and see if it matches a pattern I m looking for (if it is, I want to redirect it to run my JS (irrelevant to this) instead of navigating to said link). I need this to be generic (I don t know IDs/divs/anything except that they re <a href>s, and they have a specific URL pattern I m looking for.

我知道,即便如此,这种支持也是零敲碎打的,但现在仅仅被用作 Chrome(Firefox在不久之后,因此我不得不与它一道,因此,现在它应该成为一种oka。

让我知道是否还有其他问题。 感谢!

最佳回答

相反,当联系行动发生时,你可以追捕。 你们所寻求的模式是什么? 它只是一个“选择”权利事项:<a>。 j Query has accreditatione selectors,仅涉及任何场合,即“起步”、“端””、“contains”、“equis”、“等......

$( a[href="http://notHere.com"] ).on( click ,function(event){
    alert("omg don t go there!");
    //window.location="http://www.goHere.com";
    event.preventDefault();
});

rel=“nofollow”>jsFiddle

www.un.org/Depts/DGACM/index_spanish.htm 根据评论:

如果能积极改变你的网页,你就必须把具有约束力的活动交给一定存在的活动,并包含你们的目标。

$( body ).on( click , a[href="http://notHere.com"] ,function(event){
    alert("omg don t go there!");
    //window.location="http://www.goHere.com";
    event.preventDefault();
});

这就把点击手放在了<代码><and's>上,并从那里看望点击有关 anchor点。 如果你能够更接近,请上,例如:$(#mainContent

问题回答

暂无回答




相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签