jquerty选择器的用法

@{
ViewBag.Title = "Index";
}
<script src="../../Scripts/jquery-1.7.1.min.js"></script>
<!DOCTYPE html>
<html>
<head>
<title></title>
<style>
</style>
</head>
<body>


<div class="abc" title="1"></div>
<div class="abc" title="999"></div>

</body>
</html>

<script type="text/javascript">

$(function () {
//选择器的使用+
var cc = $("div:[class=abc]").attr("title");//选择DIV并且类名为ABC的

var cd = $(":[class=abc]").attr("title");//选择类名为ABC的

var ce = $("[class=abc]").attr("title"); //选择类名为ABC的其中:可以省略
var ce = $("[class=abc]").filter(":eq(1)").attr("title");//使用EQ其中:不能省略
alert(cc + cd+ce);


})

</script>

posted on 2015-07-27 09:36  高达  阅读(222)  评论(0)    收藏  举报

导航