我有以下標記,我想使All
單選按鈕被選中。jQuery匹配多個屬性
<ul>
<li><input type="radio" value="All" name="Foo"/>All</li>
<li><input type="radio" value="New" name="Foo"/>New</li>
<li><input type="radio" value="Removed" name="Foo"/>Removed</li>
<li><input type="radio" value="Updated" name="Foo"/>Updated</li>
</ul>
我想通過屬性來搭配,但我需要匹配2個屬性,@name='Foo'
和@value='All'
。
事情是這樣的:
$("input[@name='Foo' @value='all']").attr('checked','checked');
有人告訴這可怎麼辦呢?
XPath語法的參數(使用「 @「)已在jQuery 1.2.6中棄用,並從jQuery 1.3中刪除。 CSS語法現在是唯一可用的語法(「[attribute = value]」) – 2009-04-21 08:45:37