Not sure, but have you tried closing the tags that you're creating?
var elt1 = $('<a>hello</a>').attr('id','myId').addClass('myClass');
var elt2 = $('<span></span>');
etc.
Give that a shot. If it doesn't help, let us know and we'll take a
closer look.
--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com
On Mar 29, 2008, at 6:59 PM, [EMAIL PROTECTED] wrote:
I'm building a HTML fragment using jQuery API but I can't get it
content using the html() method: it works fine with FF, but returns
null on IE7.
As a side effect, the replaceWith() method does not work either on
IE7: the replaced element just disappear from the DOM tree.
Any idea ?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/
TR/html4/strict.dtd">
<html>
<head>
<title>Simple test using jQuery</title>
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
<script type="text/javascript" src="js/firebug/firebug.js"></script>
<script type="text/javascript" src="js/jquery-1.2.3.js"></script>
<script type="text/javascript">
$(function(){
var elt1 = $
("<a>").attr('id','myId').addClass('myClass').text("hello");
var elt2 = $("<span>");
elt2.append(elt1);
console.log("elt2.html()="+elt2.html());
$("a").replaceWith(elt2);
});
</script>
</head>
<body>
<h1>hello</h1>
<a href="http://www.google.com">This is a link</a>
</body>
</html>