jQuery > Events

Mouse enter event in jQuery

How to attach mouse enter event to a html element in jQuery?


To attach mouse enter event to a html element, mouseenter() method can be used.

<div id="spanMouseDownUp"
        style="background: green; color: White; padding: 10px;">
        Try to bring your mouse
 here
    </div>

    <script>
        $("#spanMouseDownUp").mouseenter(function () {
            $(this).html("Mouse entered in this area");
        });
    </script>

In the above code when user try to enter into the area of “spanMouseDownUp” element then “Mouse entered in this area” will be written inside it.

 Views: 4984 | Post Order: 78



Write for us






Hosting Recommendations