首页 > 网站 > WEB开发 > 正文

jquery index()

2024-04-27 15:03:14
字体:
来源:转载
供稿:网友

<html><head><script type="text/javascript" src="/jquery/jquery.js"></script><script type="text/Javascript">$(document).ready(function(){  $("li").click(function(){    alert($(this).index());  });});</script></head><body><p>点击列表项可获得其相对于同胞元素的 index 位置:</p><ul><li>Coffee</li><li>Milk</li><li>Soda</li></ul></body></html>


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表