jQuery常用的几个选择器

常用的几个选择器

$("tr:contains('王五')").addClass("selected");
给包含有王五的添加selected样式

$(this).find(":checkbox").attr('checked',true);

var hasSelected=$(this).hasClass('selected');
判断是否有selected样式

$(this).find(':radio').attr('checked',true)



选中的单选框的<tr>行将会被高亮显示
$('table:radio:checked').parent().parent().addClass('selected')

$('table:radio:checked').parents().addClass('selected')

$('tbody>tr:has(:checked)').addClass('selected');

猜你喜欢

转载自blog.csdn.net/a3060858469/article/details/80156530