Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swap class with jQuery

Tags:

jquery

Can I use jQuery to replace certain class (.a) in input fields with another (.b) one in my table?

<table id="myTable">
<tr>
    <td>Field 1</td>
    <td><input type="text" class="a"></td>
</tr>
<tr>
    <td>Field 2</td>
    <td><textarea class="a"></td>
</tr>
</table>
like image 763
santa Avatar asked Dec 07 '22 22:12

santa


1 Answers

$("#myTable").find(":input").removeClass('a').addClass('b');

See: http://jsfiddle.net/fqXvT/1/

like image 199
brendan Avatar answered Dec 25 '22 09:12

brendan