YouTip LogoYouTip

Event Mouseover

# jQuery mouseover() Method [![Image 4: jQuery Event Methods](#) jQuery Event Methods](#) ## Example Set the background color to yellow when the mouse pointer is over the

element: $("p").mouseover(function(){ $("p").css("background-color","yellow"); }); [Try it Β»](#) * * * ## Definition and Usage The mouseover event occurs when the mouse pointer is over an element. The mouseover() method triggers the mouseover event, or adds a function to run when a mouseover event occurs. **Note:** Unlike the (#) event, the mouseover event is triggered when the mouse pointer enters the selected element or any of its child elements. The mouseenter event is only triggered when the mouse pointer enters the selected element. See the demonstration example at the bottom of the page. **Tip:** This event is often used together with the (#) event. * * * ## Syntax Trigger the mouseover event for the selected element: $(_selector_).mouseover() (#) Add a function to the mouseover event: $(_selector_).mouseover(_function_) (#) | Parameter | Description | | :--- | :--- | | _function_ | Optional. Specifies the function to run when the mouseover event is triggered. | * * * ![Image 5: Example](#) ## More Examples [Difference between mouseover() and mouseenter()](#) Demonstrate the difference between mouseover() and mouseenter(). * * jQuery Event Methods](#)

← Event MouseupEvent Mouseout β†’