Mac*_*ver 1 jquery xpath jquery-selectors jquery-1.7
下面是一个工作的jQuery选择器,并将值正确设置到文本框中.为什么jQuery选择器中的XPath代码不起作用?我认为jQuery支持XPath.
jQuery代码工作:
$('html > body > form > div:nth-child(4) > label > input').val('hello world');
Run Code Online (Sandbox Code Playgroud)
jQuery代码不起作用:
$('/html/body/form/div[4]/label/input[1]').val('hello world');
Run Code Online (Sandbox Code Playgroud)
文档在这里:
http://docs.jquery.com/DOM/Traversing/Selectors
...在上面的文档中搜索此代码.... $("/html/body//p")