How to use HTML Remove Method in JQuery

This article describe about HTML Remove Method in JQuery.
  • 1645

HTML remove() method in jQuery

remove method is removed all the element from the selected position.

This method is removed all the text and child nodes in the program.

This method is not provide any return value.

Syntax

$(selector).remove()

Example

<!DOCTYPE html>

<html>

<head>

<script type="text/javascript" src="jquery.js"></script>

<script type="text/javascript">

    $(document).ready(function ()

 {

        $("button").click(function ()

 {

            $("p").remove();

        });

    });

</script>

</head>

<body>

<p>This is a JQuery.</p>

<p>This is .Netheaven.</p>

<button>Remove all p elements after click this button</button>

</body>

</html>

Output1

op1.jpg

Output2

op2.jpg

You may also want to read these related articles here

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

© 2020 DotNetHeaven. All rights reserved.