How to remove the div or element using jquery Share
In this tutorail, you will be learning how to remove the div tag or html element using jQuery.
We will be using jQuery remove() method to remove that exact html element using jQuery as given below example:
Source Code:
<!DOCTYPE html>
<html lang="en">
<head>
<title>How to remove the div or element using jquery - Elevenstech Web Tutorials</title>
</head>
<body>
<div id="myDivSection">
<h4>Hello Guys, You are going to remove this div</h4>
<p>This is a paragraph</p>
</div>
<button type="button" id="myButton">Click to remove</button>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
$(document).ready(function () {
$("#myButton").click(function() {
$("#myDivSection").remove();
});
});
</script>
</body>
</html>





Click to Join









Comments 0