Making a jQuery selection in IE on html added via .load()
Posted
by Joel Crawford-Smith
on Stack Overflow
See other posts from Stack Overflow
or by Joel Crawford-Smith
Published on 2010-05-05T19:28:06Z
Indexed on
2010/05/07
18:58 UTC
Read the original article
Hit count: 248
jquery-ajax
Scenario: I am using jQuery to lazy load some html and change the relative href attributes of all the anchors to absolute links.
The loading function adds the html in all browsers.
The url rewrite function works on the original DOM in all browsers.
But
In IE7, IE8 I can't run that same function on the new lazy loaded html in the DOM.
//lazy load a part of a file
$(document).ready(function() {
$('#tab1-cont')
.load('/web_Content.htm #tab1-cont');
return false;
});
//convert relative links to absolute links
$("#tab1-cont a[href^=/]").each(function() {
var hrefValue = $(this).attr("href");
$(this)
.attr("href", "http://www.web.org" + hrefValue)
.css('border', 'solid 1px green');
return false;
});
I think my question is: whats the trick to getting IE to make selections on DOM that is lazy loaded with jQuery?
This is my first post. Be gentle :-)
Thanks,
Joel
© Stack Overflow or respective owner