Example of mouseover event usage in jQuery

  • 2020-05-10 17:37:15
  • OfStack

This article illustrates the use of mouseover events in jQuery as an example. Share with you for your reference. The specific analysis is as follows:

The mouseover event is triggered when the mouse pointer is over the matching element or when the mouseover() method is called.
A complete event process, not only has to be able to trigger the event conditions, but also has an event handler.
You can bind event handlers for mouseover events through the mouseover() method. Such as:

$("div").mouseover(function(){$("div").text(" Welcome to script house! ")})

The code above binds the function function as an event handler to the mouseover event via the mouseover() method.
This function is called when the mouseover event is triggered.
Example code:


<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8"/>
<meta name="author" content="//www.ofstack.com/" />
<title>mouseover The event - The home of the script </title>
<script type="text/javascript" src="mytest/jQuery/jquery-1.8.3.js"></script>
<script type="text/javascript">
$(document).ready(function(){
  $("div").mouseover(function(){
    $("div").text(" Welcome to script house! ");
  })
})
</script>
</head>
<body>
<div> Original text </div>
</body>
</html>

I hope this article has helped you with your jQuery programming.


Related articles: