![](/img/trans.png)
[英]Jquery: select all elements except one with specific child with specific attribute
[英]jQuery select all A's except one specific
我需要有關jQuery的幫助,當前正在使用以下選擇器。
$("#myDiv>a")
哪個將選擇我的部門中的所有50個鏈接,如何從選定的鏈接中過濾出特定鏈接? 我的鏈接href包含“ cat -kennel”,我嘗試使用(href * -cat-kennel),但它不起作用?
您可以使用:not
選擇器。
$('#myDiv a:not([href*="cat-kennel"])');
如果您的過濾器邏輯更復雜,則可以使用filter
。
$('#myDiv a').filter(function (index) {
//return true/false based on specific logic
//'this' points to the element
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.