jQuery | mouseout() with Examples

The mouseout() method is an inbuilt method in jQuery which is used when mouse pointer moves out from the selected element.


Parameters: This method accepts single parameter function which is optional. This parameter is used to specify the function to run when the mouseout event is called.

Return Value: This method returns the selected element with the change.

Below example illustrates the mouseout() method in jQuery:


<!DOCTYPE html>
        <title>The mouseover Method</title>
        <script src=
        <!-- jQuery code to show the working of this method -->
            $(document).ready(function() {
                $("p").mouseover(function() {
                    $("p").css("background-color", "lightgreen");
                $("p").mouseout(function() {
                    $("p").css("background-color", "lightgray");
            body {
                width: 420px;
                padding: 40px;
                height: 30px;
                border: 2px solid green;
                font-weight: bold;
                font-size: 20px;
        <!-- move over this text to see the change -->
        <p>Move the mouse pointer over this paragraph.</p>

Mouse over the paragraph:

Mouse move out from the paragraph:

This article is attributed to GeeksforGeeks.org

You Might Also Like

leave a comment



load comments

Subscribe to Our Newsletter