[jQuery] Re: example on site, have question

2009-01-06 Thread Alexandre Plennevaux
Basically, what this snippet does, is 1/ adding a DIV element at the end of the BODY element; 2/ counting the new amount of DIV 3/ printing the string "there are XX dvis" in every SPAN element available in the DOM 4/ triggering the onclick() event so the script runs once on page ready. So the wh

[jQuery] Re: example on site, have question

2009-01-06 Thread Andy
What I am confussed on is there are two "Click" functions inside the ready call. I'm trying to understand why there are two? Seems like it would execute two onclick commands when this is fired. On Jan 6, 3:30 pm, "Alexandre Plennevaux" wrote: > Basically, what this snippet does, is > > 1/ a

[jQuery] Re: example on site, have question

2009-01-06 Thread Ricardo Tomasi
The first click() is being passed a function as an argument, so it's attaching that function to an event listener. The second one has no argument, so it is firing the event handlers. Try this: $(document).ready(function(){ $('body').click(function(){ // alert('Clicked?');

[jQuery] Re: example on site, have question

2009-01-06 Thread MorningZ
If you need help understanding... perhaps the documentation will help http://docs.jquery.com/Events/click#fn On Jan 6, 5:19 pm, Andy wrote: > What I am confussed on is there are two "Click" functions inside the > ready call.  I'm trying to understand why there are two?  Seems like > it would