user2632918
user2632918

Reputation:

removeClass of imageelement in a tr

I will remove on every images in the table witch have the class .rowUp a other class

$("#" + tableName + " tr").each(function () {
    $(this)
        .closest(" img.rowUp img.rowDown")
        .removeClass("imgDisplayNone");
});

But it doesnt remove the class.

The images are in the table in the row:

<tr class="OfferPosition trAvailableArticle trAvailableArticleBackground" id="2503">
    <td class="tdArticlePositionEdit">
        <img class="editPosition imgPointer" src="/images/edit.png">
    </td>
    <td class="tdArticlePositionRubbish">                                                                                                                     
        <img class="imgPointer rowUp imgDisplayNone" src="/images/arrow_up.png">
        <img class="imgPointer rowDown " src="/images/arrow_down.png">

    </td>
</tr>

the script doesn't remove the class in the image

Upvotes: 0

Views: 32

Answers (3)

PeterKA
PeterKA

Reputation: 24638

$("#" + tableName ).find('img.rowUp,img.rowDown').removeClass( "imgDisplayNone" );

Upvotes: 0

Think Different
Think Different

Reputation: 2815

You don't need a loop for this. You can do it like:

$('table').find('img.rowUp').removeClass('imgDisplayNone');

OR

$("#" + tableName +  " tr").each(function () {
     $(this)
    .find(" img.rowUp, img.rowDown")
    .removeClass("imgDisplayNone");
});

Upvotes: 1

Sudharsan S
Sudharsan S

Reputation: 15393

$("#" + tableName + " tr td").each(function()
            {
                $(this)
                    .find("img.rowUp")
                    .removeClass("imgDisplayNone" );
            });

Upvotes: 0

Related Questions