[jQuery] Processing ajax load content before it gets added to DOM ?
Hi again,
I have a snippit of code that ajax loads content for me. I want to add
target='_blank' to all the anchors before displaying it. I'm trying
thing:
function ...
$('#foo').load("/get/733/").find('a').each(function() {
this.target = "_blank";
});
A similar scheme works fine when I first load the page (non-ajax) ...
but the find/each is not working for load()'ed content.
What am I missing here ... it seems to me the find is not working
because the content is not in the DOM yet. Even if I do:
function ...
$('#foo').load("/get/733/");
$('#foo a').each(function() {
this.target = "_blank";
});
It doesn't work. Again, perhaps because the DOM update doesn't occur
until the function returns? Is this correct?
Any ideas what I could be doing wrong here?
Thx,
Sandy