Getting jQuery to Work?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Getting jQuery to Work?

Tobias Gelston
What am I doing wrong- I have the .js file referenced and the sample code in the following document

http://gelstoncafe.com/javascript/

I get nothing - no errors no effects?

What in the world am I doing so wrong?


Thanks,
Tobias

_______________________________________________
jQuery mailing list
[hidden email]
http://jquery.com/discuss/
Reply | Threaded
Open this post in threaded view
|

Re: Getting jQuery to Work?

Franck Marcia
Hi Tobias,

DOM Elements are not available until the page is load.

Wrap your code like this:

window.onload = function() {
 $("a").click(function(){
  alert("Thanks for visiting!");
 });
};

or better:

$(window).load(function() {
 $("a").click(function(){
  alert("Thanks for visiting!");
 });
});

And it should work.

Franck.

2006/6/3, Tobias <[hidden email]>:

> What am I doing wrong- I have the .js file referenced and the sample code in
> the following document
>
> http://gelstoncafe.com/javascript/
>
> I get nothing - no errors no effects?
>
> What in the world am I doing so wrong?
>
>
> Thanks,
> Tobias
>
> _______________________________________________
> jQuery mailing list
> [hidden email]
> http://jquery.com/discuss/
>
>
>

_______________________________________________
jQuery mailing list
[hidden email]
http://jquery.com/discuss/