Remove just added in hover event
Description
The following code shows how to remove just added in hover event.
Example
<html>
<head>
<script
src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {<!-- ww w. ja va 2s.c om-->
$("div").hover(function() {
$(this).append($("<span> ***</span>"));
}, function() {
$(this).find("span:last").remove();
});
});
</script>
</head>
<body>
<div>
<h1>java2s.com</h1>
</div>
</body>
</html>