0
是否有一個匹配精確文本匹配的選擇器?例如,如果我與Matt Black和Black有<select>
,並且我嘗試做'#field option:contains("Black")'
雖然我想選擇Black,但我會得到Matt Black。:eq for text類似於:包含在jquery
:eq查找索引n - 有沒有更好的方法根據它的文本內容來選擇<option>
節點?
是否有一個匹配精確文本匹配的選擇器?例如,如果我與Matt Black和Black有<select>
,並且我嘗試做'#field option:contains("Black")'
雖然我想選擇Black,但我會得到Matt Black。:eq for text類似於:包含在jquery
:eq查找索引n - 有沒有更好的方法根據它的文本內容來選擇<option>
節點?
嘗試:
$('someElement').filter(function() {
return $(this).text() == 'Some text';
});
的[jQuery選擇,包含等於]
可能重複(http://stackoverflow.com/questions/7344220/jquery-selector-contains-to-equals) – 2012-02-24 07:38:10