1

I have the following HTML code. I need to grab the code contained in the div container, but the problem is that parsing HTML with PHP Simple HTML DOM Parser I can't grab it because aria-hidden is true. How can I get it?

<div class="ui-collapsible-content"  aria-hidden="true">
text here
</div>

1 Answer 1

1

Your issue has nothing to do with the aria-hidden attribute. Finding an element works if it's hidden or not and despite any attribute.

<?php

require_once "./simple_html_dom.php";

$html = '<div class="ui-collapsible-content" aria-hidden="true">text here</div><div class="bye">visible text</div>';
$html = str_get_html($html);

echo $html->find('.ui-collapsible-content', 0)->plaintext; // text here
echo "\n";
echo $html->find('.bye', 0)->plaintext; // visible text
echo "\n";
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.