jQuery Example | Remove an Element From DOM

In jQuery, we can use remove() function to remove an element from dom. In this example, we will show you how to do.

For example:

<script>
$(document).ready(function(){
    // Removes paragraphs with class "hint" from DOM
    $("button").click(function(){
       $("p.hint").remove();
    });
});
</script>

In this example, we will remove all the <p> elements with the class .hint from the DOM.