正如此下面的代码,出现了hello能够正常运行,但是在部分微信里面maybe不能够正常的运行 所以为了保险起见,如果要进行多个dom select 需要先Array转一下
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<div class="div1">1</div>
<div class="div2">2</div>
<script>
var arr = document.querySelectorAll(".div1,.div2");
console.log(arr);
Array.from(arr).forEach(function (index,ele) {
console.log(111);
alert(‘hello‘)
});
arr.forEach(function(index,ele){
console.log(11);
alert(‘maybe‘);
});
</script>
</body>
</html>
querySelectorAll 在部分微信版本里面foreach出现的问题
原文:http://www.cnblogs.com/zerohu/p/6511398.html