How to Select Element That Does Not have Specific Class

前端 未结 5 2023
别跟我提以往
别跟我提以往 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 15:11

    Try getting an array of the parent's children instead:

    var completeTask = document.querySelector("#tasks").childNodes;
    

    Then loop/search them as necessary.

提交回复
热议问题