[jQuery] Problem with .load() in Firefox
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<font face="Trebuchet MS">Hi,
I am trying to get some html content to load into a div when a
hyperlink is clicked. The code I have is very simple and works
perfectly in IE7, but no matter what I do I can't get Firefox to use
the load() function. The code is below:
<HTML>
<HEAD>
<TITLE> Document </TITLE>
<script src="jquery-104.js" language="javascript"
type="text/javascript"></script>
<script>
$(document).ready(function(){
$("a").click(function(){
$("#test").load(this.href);
return false;
});
});
</script>
</HEAD>
<BODY>
<div id=test></div>
<a href=<a class="moz-txt-link-rfc2396E" href="http://www.google.com">"http://www.google.com"</a>>Click here</a>
</BODY>
</HTML>
When I click the link in IE7, the div gets populated with the output
from the external html page. When I click it in Firefox, it simply acts
as a regular link and redirects to the external page. After a thorough
search of the mailing list I made the following change:
$("a").click(function(e){
e.preventDefault();
e.stopPropagation ();
$("div#test").load(this.href);
return false;
});
But the only difference that it makes is that Firefox now doesn't do
anything.
I've also tried putting an alert before and after the load() function.
The both alerts get displayed in IE, but only the first one show in
Firefox, which make me think it is bailing out of the click() function
before load() is getting called.
ie.
</font><font face="Trebuchet MS"> alert("about to load");
$("div#test").load(this.href);
alert("Page Loaded");
return false;</font>
<font face="Trebuchet MS">
The version of Firefox I am running is the latest (1.5.0.9).
Any idea tips, etc. would be most welcome.
Thanks,
David
</font>
</body>
</html>
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/