I was wondering if anyone has a used and encountered this problem with IE using jquery
--- BEGIN CODE
function abc(t) {
var o = document.getElementById('dm');;
var s = "<form><button onclick='alert(\"here\");return false;' name='btn'>button</button></form>";
alert('Click ok to load DOM...');
o.innerHTML = (s + t);
alert('DOM loaded. Noticed that the javascript inside the HTML is not executed.')
alert('Click ok to load via Jquery');
$('#jq').html((s + t));
alert('Jquery completed. The
js inside the HTML is executed but check the buttons when you click.');
}
</SCRIPT>
<BODY onload="abc('<div><script type=\'text/javascript\'>alert(\'inside\');</script></div>');">
DOM getElementById
<div id="dm">dm
</div>
<br /> <br />
JQUERY:
<div id="jq">jq
</div>
--- END CODE
This works okay in FireFox but on IE, the onClick event is not fired when the HTML code is loaded using Jquery $('#jq').html(...). I have been searching the internet for an answer but couldn't find one.
The alternative is to $.bind() the button after it has been loaded.