<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<script src="../js/jquery.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
$(function(){
// 兄弟节点中排第几个
// alert($('#div3').index());
// 在参数类元素排第几
alert($('#div3').index('div'));
})
</script>
</head>
<body>
<p>pc</p>
<div id="">
div1
<div id="">
div2
</div>
</div>
<div id="div3">
div3
</div>
</body>
</html>
网友评论