var domList = document.getElementsByTagName(‘input’); var checkBoxList = []; var len = domList.length; //缓存到局部变量 while (len--) { //使用while的效率会比for循环更高 if (domList[len].type == ‘checkbox’) { checkBoxList.push(domList[len]); } }…
$(this).attr("data-id") // will return the string "123"or .data() (if you use newer jQuery >= 1.4.3)$(this).data("id") // will return the number 123注:1.两种方法 ①使用attr方法获得data-*的值 $(this).attr('data-id');② $(this).data("…