i need to be able to select Xpaths in jquery.
selecting via CSS is difficult for form elements with name, value, type, not to mention traversing down the tree.
i need to be able to select Xpaths in jquery.
selecting via CSS is difficult for form elements with name, value, type, not to mention traversing down the tree.
jQuery supports basic Xpath by default.
http://docs.jquery.com/DOM/Traversing/Selectors#XPath%5FSelectors
EDIT- Kevin said it, it's only supported in 1.2, not anymore in 1.3. Try using advanced CSS selectors, attribute filters: http://docs.jquery.com/Selectors
If you have the name of the element won't this work fine?
//by name
$('form input[name="foo"]')
//by id
$('#foo')
//by name in a specific form
$('form[name="bar"] input[name="foo"]')
//3rd option in a select
$('form[name="bar"] select[name="foo"] option:nth-child(3)')