How to use mouseenter( ) and mouseleave( ) method in JQuery

The meaning of mouse enter and mouse leave are, when your cursor enter your object bounary then mouse enter method raised similarly when your cursor goes out of your object boundary then mouse leave method raised. I will give you an example of mouse enter and mouse leave method. Lets see the example, in this, we have division, when your cursor move on your divison boundary then division background changed also text of division will be changed. This also contain mouseleave() method with the same functionality.

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default22.aspx.cs" Inherits="Default22" %>

<!DOCTYPE html>

<html xmlns="">
<head runat="server">
    <script src="Scripts/jquery-1.10.2.js"></script>
            $('div').mouseenter(function () {
                $(this).css('background-color', 'green');
                $(this).html('MY website')

            $('div').mouseleave(function () {
                $(this).css('background-color', 'red');
                $(this).html('MY Blog');


    <form id="form1" runat="server">
    <div style="height:50px;width:50px">
    Hello World !

Code generates the following output


Popular posts from this blog

difference between structure and union in C Language

Difference between Linear search and Binary Search in c language

Difference between static and dynamic websites