How to Select Element That Does Not have Specific Class

前端 未结 5 2052
别跟我提以往
别跟我提以往 2020-11-27 14:38

I\'m wondering how to select an element that does not have a specific class using JavaScript, not jQuery.

For example, I have this list:

5条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-27 14:49

    document.querySelectorAll('[wf-body=details] input:not(.switch):not(.btn)').forEach(function(e){
        // do whatever you want. with 'e' as element :P
    });
    

提交回复
热议问题