如何用jQuery更改’text-decoration’属性?

我有以下结构的表:

Element11 Element12
Element21 Element22

我希望,在检查属性text-decoration的值后,在下一行上设置’underline’。

 $('.check').click(function(){ $('infoRow').css("text-decoration", "underline"); }); 

此代码更改所有行。

提前致谢。

在下一行上加“下划线”。

(我的重点)。

在下一行中为它加下划线,您需要转到复选框的父行,然后转到其兄弟行,然后将css应用于:

 $(this).closest('tr').next('tr').css('text-decoration', 'underline'); 

另外,您可能想要测试是否正在选中或取消选中复选框,例如:

 $('.check').click(function(){ $(this).closest('tr').next('tr').css( 'text-decoration', this.checked ? 'underline' : 'none' ); }); 

实例