KJW
KJW

Reputation: 15251

jquery xpath selection not working?

I need a way to select elements via xpath (NOT CSSpath or any other method, must strictly be xpath)

$(document).find("/html[1]/body[1]/div[4]/div[2]/div[1]/h1[1]/a[1]").css("background-color", "yellow")

This doesn't seem to work.

Upvotes: 1

Views: 585

Answers (3)

Liam Bailey
Liam Bailey

Reputation: 5905

You can use xpath directly in the selector though:

http://dev-tips.com/featured/jquery-tip-using-xpath-selectors

Upvotes: -2

Guffa
Guffa

Reputation: 700262

The support for XPATH selectors was dropped from jQuery. In version 1.2 from what I can gather.

Upvotes: 6

Topera
Topera

Reputation: 12389

The method find() uses a CSS Selector, not a XPath select.

Upvotes: 0

Related Questions