views:

26

answers:

1

Hello,
I have a problem, I'm using .live() to bind mouseenter like this:

$('a').live('mouseenter',function(e){
  alert($(this).attr('title'));
});

For all my links I get an alert for the first link's title, I think the problem is from $(this) but I'm not sure, can anyone help?

+1  A: 

I don't think the code you posted is what's actually running, it works :) You can test it here: http://jsfiddle.net/YyMDg/

See what the difference is in your actual code, are you looping somewhere for example, and $(this) isn't being evaluated in the handler but somewhere outside of it?

Nick Craver