jQuery | mouseenter() with Examples

The mouseenter() method is an inbuilt method in jQuery which works when mouse pointer moves over the selected element.



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

Return Value: This method returns the selected elements with the changes made by the mouseenter() method.

Below example illustrates the mouseenter() method in jQuery:


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


Before enters the mouse over the paragraph:

After enter the mouse over the paragraph:

Related Articles:

This article is attributed to GeeksforGeeks.org

You Might Also Like

leave a comment



load comments

Subscribe to Our Newsletter