开发者

How to make an :even declaration more specific

开发者 https://www.devze.com 2023-02-04 00:49 出处:网络
I am wondering how I might make this script more specific. I am thinking that attaching an ID to specify the particular container would would work. How can that be done with the script?

I am wondering how I might make this script more specific. I am thinking that attaching an ID to specify the particular container would would work. How can that be done with the script?

Current state of script:

$('tr:even').addClass('table-alt');

Would this work?

$('#myDiv tr:even').addC开发者_开发百科lass('table-alt');


It will work assuming you have element with ID myDiv that contains table rows. If you don't have such element in the HTML it won't work.

0

精彩评论

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

关注公众号