How to remove the div or element using jquery

Kailash Singh

How to remove the div or element using jquery

Published Dec 19,2022 by Kailash Singh

0 Comment     669 Views    


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>

 


Comments ( 0 )


SEARCH POST HERE

Support Us

Subscribe My YouTube Channel

Join Our Telegram Channel & Support Eachother

CATEGORIES

INTERVIEW QUESTIONS

PROJECT SOURCE CODE






POPULAR POSTS