admin管理员组文章数量:1291021
I have some jQuery code that intercepts links clicked on a page:
$(document).ready(function()
{
$("a").click(function() {
//do something here
});
});
My problem is there are certain parts of the page that have not finished loading on document ready. They are populated via ajax calls. The links in these sections are not intercepted by my jQuery function above.
I need the function to be run on document ready initially but then I need the new links to also have the same logic applied to them.
Any help would be very much appreciated. This is an area that I am very unfamiliar with. I have written the jQuery stuff but the ajax code is an external ponent that I have no control over.
I have some jQuery code that intercepts links clicked on a page:
$(document).ready(function()
{
$("a").click(function() {
//do something here
});
});
My problem is there are certain parts of the page that have not finished loading on document ready. They are populated via ajax calls. The links in these sections are not intercepted by my jQuery function above.
I need the function to be run on document ready initially but then I need the new links to also have the same logic applied to them.
Any help would be very much appreciated. This is an area that I am very unfamiliar with. I have written the jQuery stuff but the ajax code is an external ponent that I have no control over.
Share Improve this question edited Mar 22, 2010 at 13:06 Jørn Schou-Rode 38.4k16 gold badges90 silver badges123 bronze badges asked Mar 22, 2010 at 10:43 KaskadeKaskade 7954 gold badges14 silver badges21 bronze badges 1- similar: stackoverflow./questions/4674991/… – cregox Commented Mar 5, 2011 at 3:01
2 Answers
Reset to default 9Use live()
:
$("a").live("click", function() {
//do something here
});
use live()
$("a").live('click',function() {
//do something here
});
本文标签: javascriptJqueryintercept links created by ajax requestStack Overflow
版权声明:本文标题:javascript - Jquery - intercept links created by ajax request - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741522327a2383262.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论