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 8336045
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T03:52:01+00:00 2026-06-09T03:52:01+00:00

I am currently stumped on a project I am working on. Using jQuery, I

  • 0

I am currently stumped on a project I am working on. Using jQuery, I am trying to calculate the length (number of tds) in each div object in an open row. I have a link to my demo.

http://staging.mc.vanderbilt.edu/criss/ui-projects/r4u/073112/lab.html

Clicking on a “Patient Name” opens the row and each “pill” will expand to reveal data. Some “pils” (.results) have multiple data entries. My jQuery selection should count the tds in each .results, then depending on if there are 2 or 3 or more a “.ear” shows up to allow expansion. I don’t want the ear to show if there are only 2 tds in the tr.dates row.

I have this functionality working if you click on a “pill” before opening the row. Try the “SPEP” in Patient One row.

I’m relatively new to Jquery so not great at writing complex functions or selections. Any help is greatly appreciated.

  • 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-09T03:52:03+00:00Added an answer on June 9, 2026 at 3:52 am

    To count number of tds in tr.dates, you can use something like following

    $(this).find('tr.dates td').length

    assuming $(this) will be the current “.results” div.

    So, as per your requirement if above code is equal to <= 2 don’t show “.ear”.

    Some more code to show working thing

    //Clicked on some button in tr with the class 'pt_row'
    $('.pt_row td .name, .info_row td .name').click(function() {
       //Get closest pt_row and iterate through results section in this pt_row.
       $(this).closest('.pt_row').find('.results').each(function() {
          //Count number of tds in the dates
          if ( $(this).find('tr.dates td').length <= 2 ) {
             //We have 2 or less tds. So, don't show ear
             $(this).find('.ear').hide();
          } else {
             //We have more than 2 tds. So, show ear
             $(this).find('.ear').show();
          }
       });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently, I'm working on a project where I have a server - client relationship
I'm currently working on a project in which there are about 20 c source
This is the HTML code: <div class=test onclick=$(this).vote('<$>votehash</$>', null, event)></div> I am currently using
Im using a Thermal camera for a project and I'm a little stumped so
I'm working on a Griffon app, using IntelliJ, and I'm trying to use the
Currently I am using HTML files for parts of my user interface. I display
currently, I`m implementing a map App with Mono4Droid and there I`m using a WebView
Currently working with converting SQLException error messages into messages that are more useful for
Currently I am trying to use a bunch of custom perl modules, test.pm as
I'm at the very early stages of a project requiring the broadcasting, using RTP,

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.