Page 1 of 1
Jquery document load whoes
Posted: Tue Dec 23, 2008 10:01 pm
by John Cartwright
I'm whipping up a quick form for my friend, however I am going mad trying to figure out why the following document ready does not work. This problem only occurs in Firefox. When loading the page normally, nothing within the document block is run. However, if I visit another page and back my back button everything runs perfectly. I've cleared my cache, hard refreshed, rebooted, but I simply cannot get this to work in my Firefox!
I have absolutely no idea why such a simple thing is not working (I must be missing something obvious?).
Does anyone have any clues as to what is causing this? I've attached the code below.
Thanks for reading.
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Foobar</title>
<script src="js/jquery.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
$(document).ready(function(){
alert('hi');
});
</script>
Re: Jquery document load whoes
Posted: Tue Dec 23, 2008 10:05 pm
by Syntac
That sort of thing doesn't work properly if you stick it in the <head> section, if I remember correctly. Try putting it in the <body> instead.
Re: Jquery document load whoes
Posted: Tue Dec 23, 2008 10:15 pm
by John Cartwright
I had actually tried that earlier, actually. This attempt showed no difference
It's also worth mentioning the document was xhtml 1.0 valid.
Re: Jquery document load whoes
Posted: Tue Dec 23, 2008 10:20 pm
by Syntac
Maybe Firefox is just messed...
Re: Jquery document load whoes
Posted: Tue Dec 23, 2008 10:30 pm
by John Cartwright
Something is most definitely retarded with firefox. I copy and pasted the headers from another website of mine, and I can get the document ready function to work just fine.
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>***</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><link rel="stylesheet" type="text/css" href="/css/cake.generic.css" />
<script language="javascript" src="js/jquery.js" /></script>
<script language="javascript" src="/js/jquery.popupfreeze_support.js" /></script>
<script language="javascript" type="text/javascript">
$(document).ready(function(){
alert('hi');
});
This is where things get really weird. All I could change was the title, and the jquery script inclusion. If I change a single character other than those two lines it will revert back to not working.
I'm lost.
Since this is only for a friend and not a client I'm not going to pursue this furthur and just use this. However, I am very interested in knowing what the heck is the cause. Caching gone awry perhaps?
Re: Jquery document load whoes
Posted: Tue Dec 23, 2008 10:39 pm
by Syntac
Odd. Try making sure all the tags are closed correctly (I know, I know, just making sure).
What's popupfreeze_support? Sounds useful.
Re: Jquery document load whoes
Posted: Wed Dec 24, 2008 10:05 am
by John Cartwright
Indeed everything was closed properly and was xhtml 1.0 validated.
What's popupfreeze_support? Sounds useful.
It's a custom made lightbox I made with jquery (before all the cool ones existed). The ones available now are much more useful
Thanks for the help nonetheless.
Re: Jquery document load whoes
Posted: Mon Jan 05, 2009 1:23 am
by JellyFish
Why not try using:
instead? I don't know if it will help but it's worth a try.
Re: Jquery document load whoes
Posted: Mon Jan 05, 2009 1:44 am
by jaoudestudios
Why not try putting it in a *.js file and load the external file? Sounds silly, but may be worth a try?!?!