Remove selected element

Description

The following code shows how to remove selected element.

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() {<!-- w  w w .  ja  va2 s .c  o m-->
    $("div").hover(function() {
      $(this).append($("<span> ***</span>"));
    }, function() {
      $(this).find("span:last").remove();
    });
  });
</script>
</head>
<body>
  <div>
    <h1>j ava 2s.com</h1>
  </div>
</body>
</html>

Click to view the demo





















Home »
  jQuery »
    jQuery Example »




Animation
DOM
Event
Form
List
Select
Style
Table
Utilities