1. 程式人生 > >jquery得到同一class的多個src屬性值

jquery得到同一class的多個src屬性值

<!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>