Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to remove a HTML element using Jquery

    • 0
    • 1
    • 1
    • 1
    • 0
    • 0
    • 0
    • 0
    • 514
    Comment on it

    Hello reader's,
    Below is the example to Remove the HTML element using Jquery
    If you having trouble with such issues, then use the below code.

    Here is the HTML

    <p>Write your text here.</p>
    
    <p>Write your text here.</p>
    
    <p>Write your text here.</p>
    
    <div class="img-box">
        <img src="http://jp-australia.com/2013/sup/wp-content/themes/jp-australia/img/rider&#95;profile-image&#95;dummy.png">
    </div>
    
    <button class="remove">Remove the dummy test</button>
    

    Here is the css

    img{
        max-width:100%;
        height:auto;
    }
    
    .demo {
        color: green;
        font-size: 25px;
    }
    
    .img-box{
        width:150px;
        height:150px;
        overflow:hidden;
    }
    .remove{
        margin-top:20px;
        padding:5px;
    }
    
    p
    {
        margin-bottom:15px;
        border:1px solid #000; 
    }
    

    Here is the js

    $(function(){
        $("p").click(function(){
            $(this).remove();
        });
    
        $(".remove").click(function(){
            $(".img-box").remove();
        });
    })
    

    ;

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: