Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html lang="en">
<body>
<ul>
    <li><a href="#">remove1</a></li>
    <li><a href="#">remove2</a></li>
    <li><a href="#">remove3</a></li>
    <li><a href="#">remove4</a></li>
    <li><a href="#">remove5</a></li>
    <li><a href="#">remove6</a></li>
</ul>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script> 
(function($){
  alert ($('li').children()[1].text());
$('li').children().click(function(event){ // Attach click handler to <ul> and pass event object
    // event.target is the <a>
    $(this).parent('li').remove(); // Remove <li> using parent()
    return false; // Cancel default browser behavior, stop propagation
});
  
  $('ul').click(function(event){ // Attach click handler to <ul> and pass event object
// event.target is the <a>
$(event.target).parent().remove(); // Remove <li> using parent()
return false; // Cancel default browser behavior, stop propagation
});
})(jQuery);
</script>
</body>
</html>
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers