jQuery Event How to - Handle mouse enter event








Question

We would like to know how to handle mouse enter event.

Answer


<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
  src='http://code.jquery.com/jquery-1.10.1.js'></script>
<script type='text/javascript'>
$(window).load(function(){<!--from   w  w w .  j  av a2  s  .c  om-->
    $( "#outer" ).mouseenter(function() {
      $( ".csTip" ).append( "<div>Handler for .mouseenter() called.</div>" );
    });
});
</script>
</head>
<body>
  <table>
    <th id='outer'>Agreed Bid <span class='csTip'>Hover me</span>
    </th>
  </table>
</body>
</html>

The code above is rendered as follows: