i build this really simple script but i did not work.
Can somebody tell me where the bug is?
HTML
<div id="hello" style="border: 1px solid #000000; margin:10px; padding:5px;">Hello</div>
<div style="border: 1px solid #000000; margin:10px; padding:5px;">Word</div>
<div style="margin:10px; padding:5px;">Test</div>
JS
$(function()
{
$('div').live('hover', function (event)
{
if (event.type == 'mouseover')
{
$(this).addClass('mark');
}
else
{
$(this).removeClass('mark');
}
});
});
http://www.jsfiddle.net/4pYth/4/
Thanks in advance!
Peter
I think you want to use two separate live events for this one.
Edit:
Here is a link for the differences between
mouseenterandmouseover, just in case you are curious:What is the difference between the mouseover and mouseenter events?