2

I want to get the first element using Zend_Dom_Query Example I have 2 forms in document:

<html><form/><form/></html>

How can I get the first form? I tried this: $dom->query('form:eq(1)') like jQuery selector but not success. Can you help me? Thanks a lot!

sondoha
  • 156
  • 6

1 Answers1

1

Zend_Dom_Query has a somewhat limited but pretty decent set of supported CSS selectors. :eq, though, is a jQuery-specific extension, not an actual CSS selector.

You could use Zend_Dom_Query's XPath support instead, something like:

$dom->queryXpath('//form[1]');
John Flatness
  • 32,469
  • 5
  • 79
  • 81