You can do this with javascript. Just give unique div identifiers, then you can write simple javascript like this.
document.getElementById('divid').remove();
Note. Before running remove (), load the item (s). . You can do this with jquery .
$(document).ready(function(){ document.getElementById('divid').remove(); });
Alertnativly, if you decide to add elements, perhaps some time after loading the document , and then delete them, you can check if the element exists with the following code. (using the jquery library again) can also use the css selector with the object since you are using jquery.
if ($("#divid").length > 0){ $('#divid').remove(); }
This code can be convenient if you say that you are gradually adding elements to the document using the real-time comment system, you can use setInterval () to check if the element exists, and when it does, delete it.
If you NEED to do this with php, then Brian Agnew's answer to using an HTML PHP parser should solve your problem.
source share