I have a td with follwoing class named 'rgExpandCol' and want to change the class of input inside it. below is my html:
<tr>
<td class="rgExpandCol">
<input class="rgExpand" ...
</td>
<tr>
and I have tried this jquery but I get $find is null:
$(this).closest('td').attr('rgExpand', 'rgCollapse');
EDIT :::
basically am using radgrid
and expanding rows which are hidden using
$(this).closest('tr').next('tr').css('display', '');
and $(this) is on my click event of grid as so
$("#<%=gv.ClientID%> tr:has(td)").click(function (e) {
Will apply the CSS for inputs inside the TD :)
So you want to target the td and change the class of the input inside it?
I'd do this:
$('.rgExpandCol > input').removeClass('classtoremove').addClass('newclasstoadd');
Use removeClass() and addClass() to make the change.
Assuming that the id used in the selector identifies the table.
Try this:
First you need to select the input, which can ben done with a single selector :
Then you can remove its current class and add the new one :