querySelectorAll 在部分微信版本里面foreach出现的问题

Posted 明天后浪

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了querySelectorAll 在部分微信版本里面foreach出现的问题相关的知识,希望对你有一定的参考价值。

正如此下面的代码,出现了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出现的问题的主要内容,如果未能解决你的问题,请参考以下文章

js高级选择器querySelector和querySelectorAll

javascript高级选择器querySelector和querySelectorAll

重要选择器querySelector和querySelectorAll

0158 JavaScript获取元素:id,标签名,类名,querySelector,querySelectorAll,获取bodyhtml

uniapp 微信小程序 微信7.0.12版本IOS端部分request请求被缓存

我的手机里的微信视频打开,只有声音,没有图像,显示黑屏,但看别的不是微信里的视频都是正常,声音图像