Selectora Select the set of elements that the filter expression matches is deleted.
Html:
<div class= "Container" >
<div class= "Hello" >hello</div>
<div class= "Goodbye" >goodbye</div>
</div>
We can target any element for removal:
$ ('. Hello '). Remove (); This would result in a DOM structure with the <div> element deleted:
<div class= "Container" >
<div class= "Goodbye" >goodbye</div>
</div>
The code is as follows:
$ (' div '). Remove ('. Hello '); this would the same DOM structure:
<div class= "Container" >
<div class= "Goodbye" >goodbye</div>
</div>
Look at an example
<!doctype html>
<style>p {background:yellow; MARGIN:6PX 0; }</style>
<script src= "Http://code.jquery.com/jquery-latest.min.js" ></SCRIPT>
<body>
<p>hello</p>
How are
<p>you?</p
<button>call Remove () on Paragraphs</button>
<script>
$ (" Button "). Click (function () {
$ (" P "). Remove ();
});
</script>
</body>