4

I try to find that:

<a class="one two three four five">LINK</a>

What can I do to find anchors that contain in its class "four"?

I try in this way:

$dom->find("a[class*=four]");

But it doesn't work. I'm using the html_simple_dom library.

DanMan
  • 11,323
  • 4
  • 40
  • 61
Donovant
  • 3,091
  • 8
  • 40
  • 68
  • Sorry, I didn't notice right away that you meant not jQuery solution. Please check, I updated my answer. – Ilia Ross Aug 26 '12 at 12:23
  • According to the documentation, `[attribute*=value]` should work fine. Did you triple check that you are using the correct selector? How do you know that "it does not work"? `$dom->find("a.four")` should work too and if it does not, then your document is different than you think. – Felix Kling Aug 26 '12 at 12:59
  • beacause `$dom->find("a[class*=four]");` return an array where count(array) = 0 – Donovant Aug 26 '12 at 13:05
  • What if you do `$dom->find("a")`, do you get all links? If yes, have a look which classes they have. I honestly think that your document is different... – Felix Kling Aug 26 '12 at 13:09
  • Ok, the problem was that javascript set that class, so php can't able to found it. – Donovant Aug 26 '12 at 13:33

0 Answers0