微信小程序不挣钱_jQuery完成的简略获取索引功用示例

jQuery实现的简单获取索引功能示例       这篇文章主要介绍了jQuery实现的简单获取索引功能,涉及jQuery事件响应及元素索引获取相关操作技巧,需要的朋友可以参考下
meta name="Description" content="" title 获取当前点击的元素在原来集合中的索引 /title style type="text/css" li { height: 25px; line-height: 25px; background: rgba(0,0,0,0.5); border-bottom: 1px solid red; text-decoration: none; font-size: 16px; /style /head body div a href="javascript:void(0);" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" div /div /li a href="javascript:void(0);" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" div /div /li a href="javascript:void(0);" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" div /div /li a href="javascript:void(0);" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" div /div /li a href="javascript:void(0);" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" div /div /li /ul /div script src="jquery/2.0.0/jquery.min.js" /script script type="text/javascript" $(function(){ $(".index").on("click",function(){ var $target = $(this); console.log($(".index").index($target)); /script /body /html

使用在线HTML/CSS/JavaScript代码运行工具 测试运行结果如下:

更多关于jquery相关内容感兴趣的读者可查看本站专题:《》、《》、《》、《》、《》及《》

希望本文所述对大家jquery程序设计有所帮助。


相关阅读