On Aug 22, 2007, at 5:41 AM, electroteque wrote:
Hi there, im having issues binding a click to links displayed after an
ajax call into a layer.
Here is what I have so far
$("#content a.view").click(function(event) {
alert(this.href);
return false;
});
<div id="content">
</div>
links in the ajax content is <a class="view" href="/path"> </a>
After the ajax call, the links are not within the div, using firebug,
everything is added into innerHTML, I cannot get to these at all, so
the click wont work.
I literally searched everywhere, the docs are failing to give such an
important example because im sure many use it, or need to use it this
way.
Any ideas ?
Did you look at the Frequently Asked Questions page?
http://docs.jquery.com/
Frequently_Asked_Questions#Why_do_my_events_stop_working_after_an_Ajax_r
equest.3F
Your question looks like one that is frequently asked. :-)
Also, check out Brandon Aaron's Live Query plugin (featured on Ajaxian!)
http://blog.brandonaaron.net/2007/08/19/new-plugin-live-query/
--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com