This particular error has nothing to do with the the website I was working on. This is my second post so I cannot send you the direct link to that web page. So, I’ll say it cryptically: zionthreads dot com slash jQ9 dot html.
However, I added the changes and the pages still does not work – hovering will not change anything and clicking the buttons will not make the disclaimer disappear.
You may still have other problems, but here’s the most pressing issue.
When a web browser processes an html document, it does so in a top to bottom fashion. Pretty much line by line.
So, if you have some javascript that interacts with or depends on certain html elements, those elements must exist. If those elements are defined further down in the page, then you have a problem, because as far as the browser is concerned, they don’t exist yet.
You can place your scripts further down in the html document to resolve this. You can also look at the jquery ready() method. I bet your book covers this.
One last thing. Before I start trying to get my HTML all straightened out, please set my mind at ease about my original question: Do my lines that begin with “google.load” look as though they are correctly done?
That was from before when 1.4 came out, but as you can see it’s the same apart fro the key part. That I suspect will only be use use when you use services that require your google key. jQuery and it’s UI don’t, so you can get away with not having it there, but it doesn’t cause any harm to have it there either.
Thank you so much for your help. Judging from the way that you and Sarah have been communicating with me, I feel like you are the most professional company I can remember dealing with online.
Page 19 of the jQuery ninja book says, “Every example that follows in this book, unless otherwise stated, needs to be run from inside the document-ready event.”
Does that mean that all commands should begin right before the </script> tag?
For instance,
<script>
$(document).ready(function() {
alert('You will be clicking on the radio buttons below to design your own T shirt. Click on OK to get started.');
});
The jQuery ninja book says that the plugins can be inserted in the HTML.
As you can see in the source code for zionthreads dot com slash jq22.php, I inserted the easing plugin in the head below the google.load code. It makes the header drop way down.
I like the way it is in zionthreads dot com slash jq23.php.
What is the proper way to do it?
The way you’re talking about is where the script is embedded halfway through the content of the page. That is a technique that is frowned upon, because it mixes together both the content and the behaviour, which means that you’re not capable of separating the management of the content from the behaviour.
The proper way to do it is to load the script as late as possible in the loading of the page. This commonly means placing the script tag just before the </body> tag.