Javascript Ajax jQuery Html PHP Example Quiz New MORE
Need a Website Or Web Application Or Any Help.Contact Us: +91 9437911966 (Whatsapp) Note: Paid Service

jQuery mouseenter() method with example

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

Syntax

$(selector).mouseenter(function)

Example:

	<!DOCTYPE html>
	<html>
	<head>
	<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
	<script>
	$(document).ready(function(){
	  $("input").mouseenter(function(){
		$("input").css("background-color", "yellow");
	  });
	  $("input").mouseleave(function(){
		$("input").css("background-color", "green");
	  });
	});
	</script>
	</head>
	<body>

	<input type="text">
	<p>Enter and leave the mouse on input box to see the effects.</p>
	</body>
	</html>
Run it Yourself »