国产gaysexchina男同gay,japanrcep老熟妇乱子伦视频,吃奶呻吟打开双腿做受动态图,成人色网站,国产av一区二区三区最新精品

App下載
首頁javascriptindexjQuery Method - 如何使用index()方法獲取元素索引

jQuery Method - 如何使用index()方法獲取元素索引

我們想知道如何使用index()方法獲取元素索引。


<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
  src='http://code.jquery.com/jquery-1.9.1.js'></script>
<script type='text/javascript'>
$(function(){
    $(':button').on('click', function(){
           console.log($(this).closest('.xyz').index('.xyz'));
    });
});
</script>
</head>
<body>
  <div id="abc">
    <h1>hello</h1>
    <div class="xyz">
      <input type="button">Click Me </input>
    </div>
    <h1>Hello 1</h1>
    <div class="xyz">
      <input type="button">Click Me</input>
    </div>
  </div>
</body>
</html>