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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T18:16:41+00:00 2026-06-14T18:16:41+00:00

I’ve a jQuery problem that I could use some help with. I’m trying to

  • 0

I’ve a jQuery problem that I could use some help with. I’m trying to determine a value based on values in table.

Here’s the scenario:

  1. A category is selected. This determines the column to use. Here’s
    the code for that:

    var column;
    
    if( $('input:radio[name=arc2-1]:checked').val() == 0 && $('input:radio[name=arc2-2]:checked').val() == 0) {
    column = 2;
    }else if( $('input:radio[name=arc2-1]:checked').val() == 0 && $('input:radio[name=arc2-2]:checked').val() == 1) {
    column = 3;
    }else if( $('input:radio[name=arc2-1]:checked').val() == 1 && $('input:radio[name=arc2-2]:checked').val() == 0) {
    column = 4;
    }else if( $('input:radio[name=arc2-1]:checked').val() == 1 && $('input:radio[name=arc2-2]:checked').val() == 1) {
    column = 5;
    }else if( $('input:radio[name=arc2-1]:checked').val() == 2 && $('input:radio[name=arc2-2]:checked').val() == 1) {
    column = 6;
    }else if( $('input:radio[name=arc2-1]:checked').val() == 3 && $('input:radio[name=arc2-2]:checked').val() == 1) {
    column = 7;
    }
    
  2. There’s a hidden table in the HTML that looks like this:

    <table id="ms25">
        <tr>
            <td>65</td>
            <td>5.4</td>
            <td>5.4</td>
            <td>3.1</td>
            <td>3.1</td>
            <td>3.0</td>
            <td>-</td>
        </tr>
        <tr>
            <td>55</td>
            <td>4.6</td>
            <td>4.6</td>
            <td>2.7</td>
            <td>2.7</td>
            <td>2.5</td>
            <td>-</td>
        </tr>
        <tr>
            <td>45</td>
            <td>3.8</td>
            <td>3.8</td>
            <td>2.2</td>
            <td>2.2</td>
            <td>2.0</td>
            <td>-</td>
        </tr>
        <tr>
            <td>35</td>
            <td>2.9</td>
            <td>2.9</td>
            <td>1.7</td>
            <td>1.7</td>
            <td>1.5</td>
            <td>8.1</td>
        </tr>
    </table>
    

The values in the tables don’t change. And there will always be 7 columns and 11 rows (I shortened the example).

  1. Here’s the tricky part. A number (65 or less) is entered in an input
    field. Then:

  2. The input number is checked against the first table column. The input number is “rounded up” to the next nearest number above it in the column.

  3. The number to find is the one from step 1 and step 4.

For example, if the column is 4 and the number entered is 31, you’d go to the first column and find the next nearest number “rounded up” (35), then you go over to column 4…and the number to find is 1.7.

I’ve found bits and pieces that relate to a solution (such as this: jQuery find same td in prev. and next row), but I’m unsure as to how to put it all together.

Any help/guidance as to a solution or where to look for one would be much 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-14T18:16:42+00:00Added an answer on June 14, 2026 at 6:16 pm

    You can do it like this:

    function get_table_value(column, value) {
       table = $('#ms25');
       smallestdiff = Number.MAX_VALUE;
       savedindex = 0;
       table.find('td:first-child').each(function(i) {
          diff = parseInt($(this).text(),10) - parseInt(value, 10);
          if (diff > 0 && diff < smallestdiff) {
              smallestdiff = diff;
              savedindex = i;
          }
       });
       tr = table.find('tr:eq('+savedindex+')');
       alert ( tr.find('td:first-child').text() );  //alerts 35
       alert ( tr.find('td:nth-child('+column+')').text() ); //alerts 1.7
    }
    

    See working demo

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

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
I have a small JavaScript validation script that validates inputs based on Regex. I
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I'm trying to create an if statement in PHP that prevents a single post
I have a jquery bug and I've been looking for hours now, I can't
I am reading a book about Javascript and jQuery and using one of the
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function

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.