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>
<p>
<a href="http://www.google.com">Click here</a>
</p>
</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.
alert("about to load");
$("div#test").load(this.href);
alert("Page Loaded");
return false;
The version of Firefox I am running is the latest (1.5.0.9).
Any idea tips, etc. would be most welcome.
Thanks,
David
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/