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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T21:53:30+00:00 2026-06-06T21:53:30+00:00

if(bmi < 18.5 ) { element1.backgroundColor = colour; $(document).ready(function(){ $(.C_underArrow).show(); }); } else if

  • 0
if(bmi < 18.5 )
{
    element1.backgroundColor =  colour;
    $(document).ready(function(){
      $(".C_underArrow").show();
       });
}

else if (bmi>= 18.5 && bmi<= 24.9)
{
  element2.backgroundColor =  colour;
   $(document).ready(function(){    
     $(".C_normalArrow").show();
    });
}

Am trying to color a table rows.

Depending on an input ” bmi ” .. decide which condition will use for example first condition , then coloring the element1 .

When i change the input value .. and get in the another condition and coloring element2 .. it keeps the element1 colored.

i want to color one row at every new input value

how can i solve it ?

Edit: Adding HTML code

<table class="C_resultTable">


<tr id="id1">
<td >
<img id="ID_underArrow" class="C_underArrow" width="30" height="30" src="right-arrow.gif" />
</tr>
</td>


<tr id="id2">
<td >
<img id="ID_normalArrow" class="C_normalArrow" width="30" height="30" src="right-arrow.gif" />
</tr>
</td>


<tr id="id3">
<td >
<img id="ID_overArrow" class="C_overArrow" width="30" height="30" src="right-arrow.gif" />
</tr>
</td>


<tr id="id4">
<td >
<img id="ID_ObeseArrow" class="C_ObeseArrow" width="30" height="30" src="right-arrow.gif" />
</td>
</td>       

</table>
  • 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-06T21:53:31+00:00Added an answer on June 6, 2026 at 9:53 pm

    You could store on a global var which is the currently coloured row. (var colouredElement on my code snippet)

    Without jQuery

    if (colouredElement != null)
        colouredElement.backgroundColor = '';
    
    if(bmi < 18.5 )
    {
        colouredElement = element1;
        element1.backgroundColor =  colour;
        $(document).ready(function(){
          $(".C_underArrow").show();
        });
    }    
    else if (bmi>= 18.5 && bmi<= 24.9)
    {
         colouredElement = element2;
         element2.backgroundColor =  colour;
         $(document).ready(function(){  
          $(".C_normalArrow").show();
        });
    }
    

    With jQuery

    if ($colouredElement != null)
        $colouredElement.css({ backgroundColor: ''});
    
    if(bmi < 18.5 )
    {
        $colouredElement = $('table.C_resultTable tr:nth-child(1)');
        $colouredElement.css({backgroundColor: colour});
        $(document).ready(function(){
          $(".C_underArrow").show();
        });
    }    
    else if (bmi>= 18.5 && bmi<= 24.9)
    {
        $colouredElement = $('table.C_resultTable tr:nth-child(2)');
        $colouredElement.css({backgroundColor: ''});
         $(document).ready(function(){  
          $(".C_normalArrow").show();
        });
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to solve this question: http://www.pyschools.com/quiz/view_question/s3-q6 Write a function using 'if/elif/else' conditionals to
I am trying to make a BMI Calculator using HTML. The inputs come from
BITMAPINFO bmi; memset(&bmi,0,sizeof(BITMAPINFO)); bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); bmi.bmiHeader.biWidth =m_pImg->GetWidth(); bmi.bmiHeader.biHeight =m_pImg->GetHeight(); bmi.bmiHeader.biPlanes = 1; //if(
I'm trying to create a BMI calculator. This should allow people to use either
Am trying to make a HTML page that calculate the BMI for adults and
So I'm trying to calculate my bmi using the following method. double bmi =
I'm trying to get the Body Mass Index (BMI) classification for a BMI value
Actually I am working on bmi calculator. Where I would like to calculate bmi
I'm trying to write to an AVI file using AVIStreamWrite but the resulting avi
I'm trying to rotate a bitmap image clockwise 90 degree. I've tried changing 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.