如果类具有rowSpan属性,则将类应用于TD

时间:2021-06-06 18:54:07

Looking for a really simple way in jQuery to add a class to a TD when it has the rowspan attribute.

在jQuery中寻找一种非常简单的方法,当它具有rowspan属性时,将类添加到TD。

Any ideas?

2 个解决方案

#1


2  

I think this would work:

我认为这会奏效:

$('td[rowspan]').addClass('className');

This uses the Has Attribute selector.

这使用Has属性选择器。

#2


0  

jQuery(function(){      
              jQuery('td[rowspan]')      //select all TD's with attribute=rowspan
              .addClass('class_name');   // now add class to them
});

//

#1


2  

I think this would work:

我认为这会奏效:

$('td[rowspan]').addClass('className');

This uses the Has Attribute selector.

这使用Has属性选择器。

#2


0  

jQuery(function(){      
              jQuery('td[rowspan]')      //select all TD's with attribute=rowspan
              .addClass('class_name');   // now add class to them
});

//