Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
|
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 28th, 2009, 12:16 AM
Registered User
 
Join Date: Mar 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Jquery html() on IE browser

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 />&nbsp;<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.





Similar Threads
Thread Thread Starter Forum Replies Last Post
call WCF Service using JQuery but without using AJAX informit BOOK: Professional WCF Programming: .NET Dev with Windows Communication Found ISBN: 9780470089842 0 February 23rd, 2009 01:33 AM
Article: jQuery with ASP.NET 3.5 SP1 jminatel ASP.NET 3.5 Professionals 0 February 19th, 2009 10:01 PM
Remove orphaned html elements from html string pauliehaha C# 2008 aka C# 3.0 2 June 30th, 2008 09:40 AM
Launch default browser in a new browser window haiying Beginning VB 6 1 August 30th, 2005 05:48 PM
Can you preload child html files to 1parent html? bekim Javascript How-To 4 January 22nd, 2005 04:17 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.