HOME HTML CSS JAVASCRIPT SQL PHP JQUERY XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

jQuery hover() Method

jQuery Event Methods jQuery Event Methods

Example

Change background color of a <p> element when the mouse pointer hovers over it:

$("p").hover(function(){
  $("p").css("background-color","yellow");
  },function(){
  $("p").css("background-color","pink");
});

Try it yourself »

Definition and Usage

The hover() method specifies two functions to run when the mouse pointer hovers over the selected elements.

This method triggers both the mouseenter and mouseleave events.

Note: If only one function is specified, it will be run for both the mouseenter and mouseleave events.


Syntax

$(selector).hover(inFunction,outFunction)

Parameter Description
inFunction Required. Specifies the function to run when the mouseenter event occurs
outFunction Optional. Specifies the function to run when the mouseleave event occurs


jQuery Event Methods jQuery Event Methods


Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE