Hi,
Essentially, anything that interacts with or manipulates the page must
be within the $(document).ready() function. This is considered a best
practice - the only alternative is to wrap your code in a
$(window).load( ... ), but that is highly un-optimal.
You could also put the script tag
Is it the norm to start any page that uses JQuery with:
$(document).ready(function(){
// Your code here
});
All of the tutorials mention it so I'm just trying to figure out if its
just something to help get us started or if its a best practice.
Also, does all of the code used to
Is it the norm to start any page that uses JQuery with:
$(document).ready(function(){
// Your code here
});
All of the tutorials mention it so I'm just trying to figure out if its
just something to help get us started or if its a best practice.
Also, does all of the code used to
Hi John,
Essentially, anything that interacts with or manipulates the page must
be within the $(document).ready() function. This is considered a best
practice - the only alternative is to wrap your code in a
$(window).load( ... ), but that is highly un-optimal.
Exactly what I wanted to know.
I think one of the niceties of jQuery is it's ability to compact code.
That's about the only good practice I follow. Let me analyze a
simple jQuery snippet for you to look at.
Lets say we have the following code:
a href=mailto:;user [AT] domain [DOT] com/a
And we want to turn it into this:
a