0

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

3
  • just some <button> element .. Commented Nov 19, 2011 at 20:02
  • <button> is not a valid PHP type. What PHP type is $button? Commented Nov 19, 2011 at 20:03
  • it comes from the parser :) like this: $button = $dom->find("button#save]",0); Commented Nov 19, 2011 at 20:06

3 Answers 3

3

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

$button->setAttribute("style", "display:none");
Sign up to request clarification or add additional context in comments.

Comments

1

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';

Comments

-2

Here my solution

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

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.