1、index()
It returns the index of the current element in all sibling elements inside.
<!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <ul> <li><a href="#">我是链接</a></li> <li><a href="#">我是链接</a></li> <li><a href="#">我是链接</a></li> <li><a href="#">我是链接</a></li> <li><a href="#">我是链接</a></li> <li><a href="#">我是链接</a></li> <li><a href="#">我是链接</a></li> <li><a href="# "> I am a link </a> </ li> the console.log ($ (the this) .index ()); // index () returns the index of the current element in all sibling elements inside. $ (function () { <Script> <Script src =" jQuery-1.12.4 .js "> </ Script> </ ul> <li> <a href="#"> I link </a> </ li> $ (" li "). the Click (function () { }); }); </script> </body> </html>
2、