匹配一个给定索引值的元素:从 0 开始计数
<!DOCTYPE html> <html lang=‘zh-cn‘> <head> <title>Insert you title</title> <meta http-equiv=‘description‘ content=‘this is my page‘> <meta http-equiv=‘keywords‘ content=‘keyword1,keyword2,keyword3‘> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script type=‘text/javascript‘ src=‘./js/jquery-1.12.1.min.js‘></script> <script type=‘text/javascript‘> $(function(){ var name = $(‘#list li:eq(1)‘).get(0).className; alert(name); }); </script> </head> <body> <ul id=‘list‘> <li></li> <li class=‘eq-selector‘></li> <li></li> <li></li> <li></li> <li></li> <li></li> </ul> </body> </html>
时间: 2024-10-11 03:24:26