Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8593409
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:58:57+00:00 2026-06-11T23:58:57+00:00

I have html code in which are many divs, and want delete some divs

  • 0

I have html code in which are many divs, and want delete some divs from this code, it’s so hard to do with substr() or similar php string function, maybe are better way to do this ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T23:58:58+00:00Added an answer on June 11, 2026 at 11:58 pm

    You can do this with javascript. Just give the divs unique id’s, then you can write some simple javascript like so.

     document.getElementById('divid').remove();
    

    Note: Make sure the element(s) have loaded before running the remove(). – You can do this with jquery.

    $(document).ready(function(){
         document.getElementById('divid').remove();
    });
    

    Alertnativly, if you decide to add elements maybe some time after the document has loaded, then remove them, you can check to see if an element exists with the following code. (again using the jquery library), could can also use css selectors with an object, being as you’re using jquery.

    if ($("#divid").length > 0){
        $('#divid').remove();
    }
    

    That code can become handy, if say – You gradually add elements into the document, with like a live-comment system, you could use setInterval(), to keep checking if the element exists, and when it does, remove it.


    If you NEED to do this with php then Brian Agnew’s answer of using the PHP HTML parser should solve your issue.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a td-element which can contain some HTML code, e.g. < . This
I have this HTML code which simulates a dropdown multi-checkbox <div> <div class=select> <span>Select
I'm having a strange problem. I have a HTML page with PHP code which
I have this code which can display drop down in div tag of html.
I have a html file which select images from user's computer.code is given bellow
I have following html code. In my page there are many tag which have
I have below is the html code for TD which gets appended after matching
I have the following code which loads and html file into a webview -
I have a text editor in which a user can write HTML code. I
I have the following code which creates a new table. var html = '<table>';

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.