How to change 'text-decoration' property with jQuery?

跟風遠走 提交于 2019-12-05 07:27:10

...to make 'underline' on the following row.

(My emphasis).

To underline it on the following row, you'd want to go up to the checkbox's parent row, then to its sibling row, then apply css to that:

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

Separately, you probably want to test whether the checkbox is being checked or unchecked, e.g.:

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

Live example

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!