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

  • Home
  • SEARCH
  • 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 48817
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T16:20:22+00:00 2026-05-10T16:20:22+00:00

Using jQuery, how do you bind a click event to a table cell (below,

  • 0

Using jQuery, how do you bind a click event to a table cell (below, class='expand') that will change the image src (which is in the clicked cell – original will be plus.gif, alternating with minus.gif) and hide/show the row immediately below it based on whether that row has a class of hide. (show it if it has a class of ‘hide’ and hide if it does not have a class of ‘hide’). I am flexible with changing ids and classes in the markup.

Thanks

Table rows

<tr>   <td class='expand'><img src='plus.gif'/></td>   <td>Data1</td><td>Data2</td><td>Data3</td> </tr> <tr class='show hide'>   <td> </td>   <td>Data4</td><td>Data5</td><td>Data6</td> </tr> 
  • 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. 2026-05-10T16:20:23+00:00Added an answer on May 10, 2026 at 4:20 pm

    You don’t need the show and hide tags:

    $(document).ready(function(){        $('.expand').click(function() {         if( $(this).hasClass('hidden') )             $('img', this).attr('src', 'plus.jpg');         else              $('img', this).attr('src', 'minus.jpg');          $(this).toggleClass('hidden');         $(this).parent().next().toggle();     }); }); 

    edit: Okay, I added the code for changing the image. That’s just one way to do it. I added a class to the expand attribute as a tag when the row that follows is hidden and removed it when the row was shown.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 70k
  • Answers 70k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer I think that you could use a Queue for passing… May 11, 2026 at 12:54 pm
  • added an answer With considerable effort, yes. SET @db = 'db1'; SET @q… May 11, 2026 at 12:54 pm
  • added an answer Goto cmd window then type c:\windows\system32\cscript c:\windows\system32\iisapp.vbs. Now you will… May 11, 2026 at 12:54 pm

Related Questions

Using jQuery, how do you check if there is an option selected in a
How do you rotate an image using jQuery-rotate plugin? I have tried the following
How do you set the cursor position in a text field using jQuery? I've
Using core jQuery, how do you remove all the options of a select box,
So I've been working on this all day and I can't figure out how
This is a bit of a tough question to ask. I am using asp.net

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.