There are 5 li element and one of them say third li is hidden.Is there a way to apply filter before getting index so that fourth element's index should show 2 instead of 3.
(有5个li元素,其中一个说第三个li是隐藏的,有没有一种方法可以在获取索引之前应用过滤器,以便第四个元素的索引应该显示2而不是3。)
<html>
<head>
<title>test</title>
<script type='text/javascript' src='js/jquery-1.4.2.js'></script>
<script>
$(window).load(function() {
jQuery('.addchar').live('hover', function(event) {
$("#result").html("Index is:" +$(this).index() );
});
});
});
</script>
</head>
<body>
<div id="content">
<div>
<ul>
<li class="addchar">one </li>
<li class="addchar">two </li>
<li class="addchar" style="display:none"> three</li>
<li class="addchar">four </li>
<li class="addchar">five </li>
</ul>
</div>
<div id="result"></div>
</div>
</body>
</html>
ask by kiranking translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…