简体   繁体   中英

Selector Elements by AttributeS possible?

Short small question. Can something like that work and when yes does it also work with IE11? And if there are some mistakes please tell me.

$("option[class='sorted'] && !(option[title='"+look+"'])").remove;

您需要将属性选择器与:not()结合使用来进行求反操作

 $("option.sorted:not([title='"+look+"'])").remove();

Try something like this...

$("option.sorted").not("[title='"+look+"']").remove();

Doing it this way lets you leverage the performance of the browser's query selector.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM