.hover( )

Calling $( selector ).hover( handlerIn, handlerOut ) is shorthand for:

$( selector ).mouseenter( handlerIn ).mouseleave( handlerOut );

ex:

$( "td" ).hover(
  function() {
    $( this ).addClass( "hover" );
  }, function() {
    $( this ).removeClass( "hover" );
  }
);

to remove the above:

$( "td" ).off( "mouseenter mouseleave" );

.keydown( ), .keyup( ), & .keypress( ),

  • .keypress( ) is the only one of these that will record the character code.
  • Note that .keydown() and .keyup() provide a code indicating which key is pressed, while .keypress() indicates which character was entered. For example, a lowercase "a" will be reported as 65 by .keydown() and .keyup(), but as 97 by .keypress(). An uppercase "A" is reported as 65 by all events. Because of this distinction, when catching special keystrokes such as arrow keys, .keydown() or .keyup() is a better choice.

results matching ""

    No results matching ""