Php simple html dom remove div with specific class

I am using the code below to get some content. My problem is that I don't know how to avoid / bypass / remove a specific div.

html Structure:

<div class="post-single-content box mark-links">
<div class="sharebar-wrap">dfdfdfd</div>
</div>

      

And I am using the following code to get the content:

foreach($html->find('div[class=post-single-content box mark-links]') as $table)
{
$arr44[]=  $table->innertext ;
}

      

How can I avoid or remove or work around to grab a div using the sharebar-wrap class? I do not need it!

Hooray!!

+3


source to share


2 answers


You can actually use jQuery like Héctor E mentioned, otherwise you can use raw javascript:



document.querySelector('.sharebar-wrap').remove();

      

+1


source


With javascript:

var aux = document.getElementByClass('sharebar-wrap');
aux.parentNode.removeChild(aux);

      



With jQuery:  $( ".sharebar-wrap" ).remove()

+1


source







All Articles