Tye Lucas
Tye Lucas

Reputation: 107

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!

Upvotes: 1

Views: 360

Answers (2)

Tye Lucas
Tye Lucas

Reputation: 107

Thank you I changed my code to:

            $('#modalAdd').on('hidden.bs.modal', function (e) {
            $(".active").attr("aria-selected","false");
            $(".active").removeClass("active");
            $(".select-box").attr("checked", false);

Upvotes: 1

Pranav C Balan
Pranav C Balan

Reputation: 115222

Use jQuery attr() method to update element attribute.

$('tr').attr('aria-selected','false');

Upvotes: 4

Related Questions