PHP Classes

problem with id and class with spaces

Recommend this page to a friend!

      HTMLPP  >  All threads  >  problem with id and class with spaces  >  (Un) Subscribe thread alerts  
Subject:problem with id and class with spaces
Summary:problem with id and class with spaces
Messages:2
Author:sasbtcpp
Date:2011-12-29 21:50:49
Update:2011-12-30 08:03:03
 

  1. problem with id and class with spaces   Reply   Report abuse  
Picture of sasbtcpp sasbtcpp - 2011-12-29 21:50:50
Hello

How can we send a class name with spaces?

As you can see bellow, my class name is "data up" and the getElementsByClassName function can't use names which have spaces!

$document=& $HTML->getDocument();
$h= $document->body->getElementsByClassName("data up");
$h=& $h->get(0);
$s= $h->getInnerHTML();

Thanks.

  2. Re: problem with id and class with spaces   Reply   Report abuse  
Picture of Marco Marchiņ Marco Marchiņ - 2011-12-30 08:03:03 - In reply to message 1 from sasbtcpp
Sorry i don't mantain this package anymore. Anyway getElementsByClassName works with one class and you are looking for two classes, so you can't use it. Maybe you can try something like:
$document=& $HTML->getDocument();
$h= $document->body->getElementsBySelector(".data.up");
$h=& $h->get(0);
$s= $h->getInnerHTML();

 
For more information send a message to info at phpclasses dot org.