我正在为html开发一个小的查询模块( js),我想提供一个通用的query(selector)函数,支持css选择器和XPath选择器作为字符串参数。 不管每种选择是如何完成的,我这里的问题是如何识别给定的字符串是xpath还是css选择器。我们可以假设函数是这样的: function query(selector){
selectorKind = identifySelectorKind(selector); // I want to know how to code this particular function
if(selectorKind==="css
为了明确起见,让我们从下面的示例开始:
function validation(){
$("[name='test']").focus();
// my goal is to focus on the 'name' radio button
//$("[name='test'] return an array with 2 items, but i don't know how to select
//an item, i know that i can use
因为这个错误,我已经头疼了一天了。
The jQuery object is actually just the init constructor 'enhanced'
return new jQuery.fn.init( selector, context, rootjQuery );
} has no method 'curCSS'
我的html是:
<input class="field2" type="text" name="time" placeholder="Time"