开发者

Defining array index in a jQuery selector

开发者 https://www.devze.com 2023-01-21 06:16 出处:网络
I have several tables in my HTML markup which don\'t have any attributes and I\'m wondering: is it possible to define a jQue开发者_如何学JAVAry selector which directly picks eg. the third table?In add

I have several tables in my HTML markup which don't have any attributes and I'm wondering: is it possible to define a jQue开发者_如何学JAVAry selector which directly picks eg. the third table?


In addition to Tim's answer, there's a :eq() version you can use inside a selector as well, for example:

$("#myContainer table:eq(2) tr")


yeah you can use eq from jquery

$('table').eq(2).css('background-color', 'red'); for example this gets the third table (zero-based counting, jquery starts counting with zero therefor eq(2)) and give it a red background color.

0

精彩评论

暂无评论...
验证码 换一张
取 消