Javascript 对于类的每个表';y';,如果表不包含类为';x';,选择th和td子体
对于类“y”的每个表,如果表不包含类为“x”的子体,请选择降序th和td元素,然后删除它们的宽度属性 以下是我目前掌握的情况:Javascript 对于类的每个表';y';,如果表不包含类为';x';,选择th和td子体,javascript,jquery,jquery-selectors,Javascript,Jquery,Jquery Selectors,对于类“y”的每个表,如果表不包含类为“x”的子体,请选择降序th和td元素,然后删除它们的宽度属性 以下是我目前掌握的情况: $(document).ready(function(){ $('table.y').has(':not(.x)').find('td').removeAttr('width') $('table.y').has(':not(.x)').find('th').removeAttr('width') }); 您可以使用not方法和:has选择器,对于排
$(document).ready(function(){
$('table.y').has(':not(.x)').find('td').removeAttr('width')
$('table.y').has(':not(.x)').find('th').removeAttr('width')
});
您可以使用
not
方法和:has
选择器,对于排除元素,首先应使用not
方法或:not
选择器
$(document).ready(function(){
$('table.y').not(':has(.x)').find('td, th').removeAttr('width')
});
您可以使用
not
方法和:has
选择器,对于排除元素,首先应使用not
方法或:not
选择器
$(document).ready(function(){
$('table.y').not(':has(.x)').find('td, th').removeAttr('width')
});