jQuery .remove()

jQuery .remove() removes target element;

<script>
$(function(){
    $('.target').click(function() { // click to remove element
        $('.elements span:first').remove();
    });
});</script>
<div class="well">
    <p>
        <span class="target btn btn-primary">click me to remove element</span>
    </p>
    <div class="elements alert alert-block">
        <span class="label label-info">elment 1</span>
        <span class="label label-info">elment 2</span>
        <span class="label label-info">elment 3</span>
        <span class="label label-info">elment 4</span>
        <span class="label label-info">elment 5</span>
        <span class="label label-info">elment 6</span>
        <span class="label label-info">elment 7</span>
    </div>
</div>

Leave a Reply

Your email address will not be published. Required fields are marked *