$("*")选择全部元素
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>id</title>
<script src="http://code.jquery.com/jquery-1.11.3.js"></script>
</head>
<body>
<div class="aaron">
<p>id="aaron"</p>
<p>选中</p>
</div>
<div class="aaron">
<p>id="aaron"</p>
<p>选中</p>
</div>
<div class="imooc">
<p>id="imooc"</p>
<p>jquery选中</p>
</div>
<div class="imooc">
<p>id="imooc"</p>
<p>jquery未选中</p>
</div>
<script>
var el = document.getElementsByTagName("*");
var $el = $("*");
if(el.length===$el.length){
$el.css("border","4px solid green");
}
</script>
</body>
</html>
本文标题:$("*")选择全部元素
本文链接:https://www.haomeiwen.com/subject/qlmrhftx.html
网友评论