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

App下載
首頁javascriptchildren_indexjQuery Selector - 如何選擇后獲取元素索引

jQuery Selector - 如何選擇后獲取元素索引

我們想知道如何選擇后獲取元素索引。

<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
  src='http://code.jquery.com/jquery-1.7.1.js'></script>
<script type='text/javascript'>
$(function(){
    var triggers = $('a');
    triggers.on('click', function() {
       var index = triggers.index($(this));
       console.log(index)
    });
});
</script>
</head>
<body>
  <a href="#">0</a>
  <a href="#">1</a>
  <a href="#">2</a>
</body>
</html>