jquery得到同一class的多个src属性值

版权声明:本文为QQ帝国原创博客,非经本人同意,且勿转载。。 https://blog.csdn.net/QQ_Empire/article/details/83147671
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<style>
		.暗示法{width: 100px;height: 100px ;background: red;}
	</style>
	<body>
		<div>
			<div class="暗示法"></div>
			<div class="暗示法"></div>
			<div class="暗示法"></div>
			<div class="暗示法"></div>
			<div class="暗示法"></div>
		</div>
	</body>
	<script type="text/javascript" src="jquery-1.11.0.js" ></script>
	<script>
		
		
		var arr = [];
		
			$(".暗示法").each(function() {
			  arr.push($(this).attr("class"));
			});
			
			
			
			alert(arr);
			
		
	</script>
</html>

猜你喜欢

转载自blog.csdn.net/QQ_Empire/article/details/83147671