Created
April 28, 2011 03:59
-
-
Save ifandelse/945771 to your computer and use it in GitHub Desktop.
Testing Script Element Insertion with jQuery and IE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" | |
"http://www.w3.org/TR/html4/loose.dtd"> | |
<html> | |
<head> | |
<title></title> | |
<script type="text/javascript" src="js/jquery-1.5.2.js"></script> | |
<script type="text/javascript"> | |
$(function(){ | |
var node = $("<script/>", { | |
"type": "text/javascript", | |
"id":"myTemplate" | |
,"textContent":"alert('Hey it worked!')" // this works in IE | |
})['appendTo']("body"); | |
var nodeB = $("<div />", {"text": "Did this work??!"}).appendTo("body"); | |
var node = $("<script/>", { | |
"type": "text/javascript", | |
"id":"myTemplateB" | |
,"text":"alert('Hey it worked again!')" // this fails in IE | |
})['appendTo']("body"); | |
var nodeB = $("<div />", {"text": "Did this work AGAIN??!"}).appendTo("body"); | |
}); | |
</script> | |
</head> | |
<body> | |
<h3>Testing Script Element Insertion w/jQuery and IE.</h3> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment