按索引获取 [英] get row by index
本文介绍了按索引获取的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何通过索引获得一行?
how can you get a row by the index?
var rows = $('tr', tbl);
rows.index(0).addClass('my_class');
推荐答案
使用.eq()
.
var rows = $('tr', tbl);
rows.eq(0).addClass('my_class');
...或简单的情况,为.first()
:
...or for your simple case, .first()
:
rows.first().addClass('my_class');
这篇关于按索引获取的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文