Tye Lucas Tye Lucas - 1 year ago 44
jQuery Question

How to remove an element from a <tr>

Here is the code:

<tr class="active" aria-selected="true" data-row-id="3">

I am using: $("tr").removeClass("active"); to remove the "active" class which works perfectly but I also need to set aria-selected="true" to "false", this is for a data-table selection in a modal. Any help will be most helpful,

Thank you!

Answer Source

Use jQuery attr() method to update element attribute.