w3resource
jquery exercises

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?



New Content: Composer: Dependency manager for PHP, R Programming