<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title></title>
<style>
div {
100px;
height: 90px;
float: left;
padding: 5px;
margin: 5px;
background-color: #EEEEEE;
}
.c{display:none;
}
</style>
<script
src="https://www.imooc.com/static/lib/jquery/1.9.1/jquery.js"></script>
</head>
<body>
<div id="aaron">
<p>id="aaron"</p>
<p>选中</p>
</div>
<div class="imooc">
<p>id="imooc"</p>
<p>jQuery选中</p>
</div>
<div class="left imooc" title = "empty测试" id="cs"></div>
<div class="c">测试隐藏</div>
<div class="div">
<input type="radio" name="dan"/> 单选</input><br>
<input type="radio" name="dan"/> dan</input>
</div>
<script type="text/javascript">
//通过原生方法处理
var div = document.getElementById('aaron');
div.style.border = "3px solid blue";
</script>
<script type="text/javascript">
//通过jQuery直接传入id
//id的唯一,只选择到了第一个匹配的id为imooc的div节点
$(".imooc:contains(jQuery选中)").css("border", "3px solid red");<!--元素
(标签)内空格都不允许存在-->
</script>
<script type="text/javascript">
$(".imooc:empty").css("border-left","3px dotted #00ffff");
$(".imooc:empty").css("border-right","3px dotted red");
$(".imooc>p:first-child").css("border","5px solid yellow");
$("#cs").css("border-bottom","5px solid blue");
$(".c:hidden").css("border","5px solid blue");
$(".div>input:first-child").css("border","5px solid blue");
</script>
</body>
</html>