On Dec 10, 7:53 pm, SyLon <[EMAIL PROTECTED]> wrote:
> Hello everyone!
> Could someone please explain me how could this be??
Let's see if I've got this straight ...
> ...
> $(".flag").hide();
Everything with a class of 'flag' is now hidden...
> ...
> $(".flag").click(function (){
> alert("hello");
> });
A click handler is now bound to everything that has a class of 'flag',
but that click handler won't fire.
Umm ... every element that you might be able to click on to make it
fire is currently hidden!
If you can't click on it with a mouse, the only way to get it to fire
is to trigger it from code...
> ...
> $(".flag").click(function (){
> alert("hello");
> }).click();
...and, hey presto, that's exactly what this alternative does. It
binds the click handler, then immediately triggers a click event.
No problem!
> It seems like the browser just doesn't see the click event! Weird..
> Could some one help me please??
> Thanks, Leon.