Fuxi
Fuxi

Reputation: 7599

PHP Simple HTML DOM Parser display none

i'm trying to figure out how to set elements invisible using the parser. here's what i tried which didn't work unfortunately:

$button->style = "display:none";

any ideas? thanks

Upvotes: 1

Views: 2838

Answers (3)

Thoman
Thoman

Reputation: 792

Here my solution

$html->find('div[style=display:none]')

Upvotes: -2

hakre
hakre

Reputation: 198117

I don't know which parser you're using, but if you want to hide some HTML element, you need to set the style attribute to display:none.

So access the style attribute of that button and set it / extend it with display:none.

According to the reference given at http://simplehtmldom.sourceforge.net/ (if that is the component you're using), this should do it:

$dom->find("button[id=save]",0)->style = 'display:none';

Upvotes: 1

Aurimas Ličkus
Aurimas Ličkus

Reputation: 10074

Use set setAttribute method http://php.net/manual/en/domelement.setattribute.php

$button->setAttribute("style", "display:none");

Upvotes: 3

Related Questions