need xpath selector plugin for jquery
i need to be able to select Xpaths in jquery.
selecting via CSS is difficult for form elements with name, value,开发者_如何学C type, not to mention traversing down the tree.
jQuery supports basic Xpath by default.
http://docs.jquery.com/DOM/Traversing/Selectors#XPath_Selectors
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)')
精彩评论