In this article we will explain how to use remove() method in jQuery or What is remove() method in jQuery or why remove() method in jQuery or how to remove the selected elements from the DOM with example.

  • Description:

  • The jQuery remove() method is used to remove the selected elements from the DOM. It removes the selected element itself, as well as everything inside it (including all content and html elements). This method also removes the data and the events of the selected elements.




  • Example of jQuery remove() method

 <!DOCTYPE html>
    <script src=""></script>
        $(document).ready(function () {
            $("button").click(function () {
        <button>Click here to remove() paragraph</button>
        <div style="width:500px">
            <p style="background-color:ghostwhite;">
                Lorem Ipsum is simply dummy text of the printing and typesetting industry.
                Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,
                when an unknown printer took a galley of type and scrambled it to make a type
                specimen book. It has survived not only five centuries, but also the leap into
                electronic typesetting, remaining essentially unchanged. It was popularised in
                the 1960s with the release of Letraset sheets containing Lorem Ipsum passages,
                and more recently with desktop publishing software like Aldus PageMaker including
                versions of Lorem Ipsum.
            <div style="background-color:#d5d5d5; margin-top:10px;">
                Lorem Ipsum is a long established fact that a reader will be distracted by
                the readable content of a page when looking at its layout. The point of using
                Ipsum is that it has a more-or-less normal distribution of letters, as opposed
               'Content here, content here', making it look like readable English. Many desktop
                packages and web page editors now use Lorem Ipsum as their default model text,
                search for 'lorem ipsum' will uncover many web sites still in their infancy.
                versions have evolved over the years, sometimes by accident, sometimes on purpose
                (injected humour and the like).


Remove element in jquery

In above example when you click on button remove the all “p” element from the Dom.

I hope this article will help to you.


Leave a comment

Make sure you enter the (*) required information where indicated. HTML code is not allowed.

you may also like