tags:

views:

29

answers:

3

Using jQuery, how can I remove the class header from all <th> elements with the attribute nofilter="True"?

<th class="header" nofilter="True" scope="col" align="left">City</th>

The result should be:

<th nofilter="True" scope="col" align="left">City</th>
+2  A: 

As the comments noted, I rushed my answer, the correct statement would be

$("th[nofilter='True']").removeClass("header");

http://docs.jquery.com/Removeclass

DrColossos
Actually he wants to only affect the ones with that "nofilter" attribute, so it'd be `$('th[nofilter=True]').removeClass('header')`
Pointy
This would remove all classes. But only th with nofilter="True" should be removed
Yepp, now I see it, didn't got that the first time, sorry.
DrColossos
+3  A: 

Use the Attribute Equals Selector:

$("th[nofilter='True']").removeClass("header");
Justin Ethier
+1  A: 
$("th[nofilter='True']").removeClass("header");

this should work for nofilter="True" only

Rito