for of loop querySelectorAll

前端 未结 9 844
忘了有多久
忘了有多久 2020-12-11 02:29

Mozilla states that \"for of loops will loop over NodeList objects correctly\". (source: https://developer.mozilla.org/en-US/docs/Web/API/NodeList) However, this doesn\'t wo

9条回答
  •  误落风尘
    2020-12-11 02:40

    This is what I do, for a different approach

    Array.prototype.forEach.call(document.querySelectorAll("input[type=checkbox]"),function(ele,idx)
    {
        ele.checked = true;
    }
    

    good from IE9 and above

提交回复
热议问题