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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T18:52:10+00:00 2026-06-17T18:52:10+00:00

I have a table with a list of records. each row has class list_request

  • 0

I have a table with a list of records. each row has class “list_request” and has a cell of class “record_approval”:

<table>
<tr>
    <th>name</th><th>date</th><th>id</th><th>group</th><th>approval</th>
<tr class="list_request">
<td>Frank</td><td>2012-2-15</td><td>01</td><td>Account</td><td class="record_approval">Dave Ellis</td>
</tr>
<tr class="list_request">
<td>Ellen</td><td>2012-2-19</td><td>04</td><td>Admin</td><td class="record_approval">Susan Peters</td>
</tr>
<tr class="list_request">
<td>Michael</td><td>2012-2-26</td><td>06</td><td>Admin</td><td class="record_approval"></td>
</tr>

I’d like to construct a javascript function that checks whether or not “record_approval” has a value (which value is unimportant), and if so, change the css color value for that row. Essentially, the approved records should have a different color than the unapproved ones.
something like…

function check_approval(){
    var checkrow = document.querySelectorAll( "tr.request_list" )
    var checkcell =  document.querySelectorAll( "td.record_approval" )

    for (i=0;i<checkcell.length;i++){  
    if (!checkcell.value){
        this.parentNode.style.color = "ff9900";
    }  
    else{

    }
}

is this essentially the wrong approach?

  • 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-17T18:52:11+00:00Added an answer on June 17, 2026 at 6:52 pm

    Mistakes I found:

    • Unclosed for loop (missing closing })
    • You’re looking for class request_list, but on your html it’s list_request
    • You should be using checkcell[i] instead of checkcell inside your loop
    • Your color hex value should begin with a #.
    • There’s no need to get all rows and cells from an event listener
    • It’s unclear when you want that function to run. Should it respond to an event?

    Also, I’d set a new css class on the row, instead of setting the color directly.


    Apparently, you’re looking for this:

    var checkcell =  document.querySelectorAll( "td.record_approval" );
    for (i=0;i<checkcell.length;i++){  
        if (checkcell[i].innerHTML){
            checkcell[i].parentNode.style.color = "#ff9900";
        }
    }
    

    http://jsbin.com/anadij/1/edit

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

Sidebar

Related Questions

I have a table which has a list of invoices and their details: class
I have a table consisting of records of every match that every player has
I have some 30,000 records in my Raw_deals table and some raw_cities table has
I have an html table, and on each row, i would like to add
I have a Table A with thousands of records. On each displayed page, only
In rails when displaying a list of table records, I have a column which
You have a pseudo-table class and a pseudo-row class. The row is somewhat generic
I have a list of 'request' objects, each of which has fairly normal activerecord
I have a table containing in every row one cell inside which is checkbox
I have a table with a list of items. I add the records from

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.