jquery动态获取节点

时间:2019-03-12 11:17:10   收藏:0   阅读:182

<html>
<head>
<script type="text/javascript" src="/jquery/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#cool input").click(function(){
alert($(this).index());
});
});
</script>
</head>
<body>
<p>点击列表项可获得其相对于同胞元素的 index 位置:</p>
<ul id="cool">
<input type="button" value="0">
<input type="button" value="1">
<input type="button" value="2">
</ul>
</body>
</html>

原文:https://blog.51cto.com/13238147/2360890

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!