[jQuery] Appending Element to iFrame body blowing up in IE
Hi,
When I try to append and element to an iframe body it does not work in
IE. However, it works fine in FF.
Below is a simplified example of the issue. As you can see, using the
same element reference (iBody) I can acess the .html() function.
However append, blowup.. Any ideas?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />
<title>Untitled Document</title>
<script language="JavaScript" src="http://ajax.googleapis.com/ajax/
libs/jquery/1.2.6/jquery.min.js" type="text/javascript">
google.load("jquery", "1.2.6");
</script>
<script language="JavaScript" type="text/javascript">
$(document).ready( function(){
// Grab the pointer to iframe body element
var iBody = $("#testFrame").contents().find("body");
// Put some text in the iFrame body element to prove we have
the right thing.
$(iBody).html("Loaded");
//Create an element to append (much simplified)
var ol = $("<ol><li>test</li></ol>");
// Append blowing up in IE not FF
$(iBody).append( ol );
});
</script>
</head>
<body>
<iframe id="testFrame" width="300" height="300"></iframe>
</body>
</html>