jQuery hover
takes two functions, an "over" and an "out".
$(".tabContents a").hover(function() {
alert("mouse over!");
}, function(){
alert("mouse out!");
});
If you're just looking for mouseover, I would suggest:
$(".tabContents a").mouseover(function() {
alert("just work!");
});
Further Response:
Try using jQuery's live
event. This will ensure that the event listener will also be paying attention for any new elements added to the DOM (like the ones you're appending). However, live does not currently support hover
. You can do a mouseover
and a mouseout
event though to achieve the same effect.
$('.tabContents a').live('mouseover', function(){
alert('mouseover!');
});
$('.tabContents a').live('mouseout', function(){
alert('mouseout!');
});
I think I saw that somebody wrote an extension for jQuery that allowed for the use of 'hover' with live
in a response to a question here on SO, so it can be done, but alas, I cannot seem to find it.