tags:

views:

277

answers:

1

i need to select based on xpath , or convert xpath to css.

is there a plugin or built in function.

ex. $('/html/body/div/a[4]').each ....

+1  A: 

Not all xpath expressions are translatable to CSS-like selectors. For example you can't access elements by index. For that you would have to use the jQuery function get. This would be equivalent of the xpath in your example:

$('html > body > div > a').get(4).each( ...
Guffa