Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9135159
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:47:16+00:00 2026-06-17T08:47:16+00:00

Right now I have the following Jquery, which when clicking on a table row

  • 0

Right now I have the following Jquery, which when clicking on a table row it closes the rows under it.

<script type="text/javascript">
$(function () {
    $("tr.spaceUnder").hide();
    $('tr:not(.spaceUnder)').click(function () {
        $(this).nextUntil('tr:not(.spaceUnder)').toggle();
    });
});

Now what I want is when I click on the row which toggles the rows under it, is to show an open / close icon or +/- whatever.

This is what the row looks like which has the toggle on it.

<tr class="countryRow categoryHeader">
        <td colspan="3" class="">
            <span class="listItemHeader">
                <%#((Item)Container.DataItem)["Name"]%>
            </span>
        </td>
        <td>
            <a href="#" style="float: right;"><img width="20"  src="/Images/sBackTopPic.png"></a>
        </td>
    </tr>

So on the toggle I would like to change css class on the a href in the second td in the row, so on initial load show closed icon since, then on click the open icon..then when click again the closed icon. So I was wondering how I could add the css class on my a href with my current toggle logic.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T08:47:17+00:00Added an answer on June 17, 2026 at 8:47 am

    It is confusing exactly what you are trying to do. but below on your click function it checks the anchor to see if it has class-one, if it does then remove that class and add another class. If not do the opposite.

    $(function () {
            $("tr.spaceUnder").hide();
            $('tr:not(.spaceUnder)').click(function () {
                $(this).nextUntil('tr:not(.spaceUnder)').toggle();
                if($('a', this).hasClass("class-one"))
                {
                  $('a', this).removeClass("class-one");
                  $('a', this).addClass("class-two");
                {
                else
                {
                  $('a', this).removeClass("class-two");
                  $('a', this).addClass("class-one");
                }
            });
        });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following jQuery script running on my page: <script type=text/javascript charset=utf-8 src={{
I have the following jQuery code for finding the sum of all table rows,
Right now I have the following code working: @UiHandler(usernameTextBox) void onUsernameTextBoxKeyPress(KeyPressEvent event) { keyPress(event);
I want to match dates that have the following format: 2010-08-27, 2010/08/27 Right now
Right now I have a script that will get the last five files in
I have the following jQuery function: function GetGrandparentDiv(item) { return item.parents('div:eq(1)'); } Which is
Hi I'm tearing my hair out right now, I found this script online which
I have a php page which includes jQuery and a script.js file. When I
Good day! I right now have a function the drags an element from a
Right now I have an upload field while uploads files to the server. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.