w3resource

jQuery: On mouseout of anchors, alert the element type being entered

jQuery Fundamental - II : Exercise-94

On mouseout of anchors, alert the element type being entered.

<body>
<a  href="https://www.w3resource.com/">Visit w3resource</a>
</body>

Sample solution :

HTML Code :

<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-git.js"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>On mouseout of anchors, alert the element type being entered.</title>
</head>
<body>
<a href="https://www.w3resource.com/">Visit w3resource</a>
</body>
</html>

JavaScript Code :

$( "a" ).mouseout(function( event ) {
console.log(event.relatedTarget.nodeName );
});

See the Pen jquery-fundamental-exercise-94 by w3resource (@w3resource) on CodePen.


Contribute your code and comments through Disqus.

Previous: Display previous handler's return value.
Next: jQuery Core

What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://w3resource.com/jquery-exercises/2/jquery-fundamental-exercise-94.php