Link to home
Start Free TrialLog in
Avatar of Pedro Chagas
Pedro ChagasFlag for Portugal

asked on

Jquery - what was the id that triggered the event

Hi E's,
I have this code:
$("#one, #two").focus(function(){
    alert($(this).is(":focus"));
    }); 

Open in new window

And I have to know what was the id that triggered the event.
The output of this code is false!
How I know if it is the #one or the #two id that triggered the event?

The best regards, JC
Avatar of Randy Poole
Randy Poole
Flag of United States of America image

change your alert to :
alert($(this).id);

Open in new window

to see what you get
ASKER CERTIFIED SOLUTION
Avatar of Gary
Gary
Flag of Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Pedro Chagas

ASKER

Hi Randy, the output is "undefined".
Thanks for trying to help.

The best regards, JC