Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

203
Views
Color handlebars table row depnding on value

How do i color a specific row in a table depending on the value in that row?

                {{#each files}}
                <tr>
                    <td style="text-align:left">{{filename}}</td>
                    {{#if status === "Completed"}}
                    <td style="text-align:right color:green">{{status}}</td>
                    {{#else status === "Pending"}}
                    <td style="text-align:right color:yellow">{{status}}</td>
                </tr>
                {{/each}}

I loop through a list of files and i want to color the status depending if the value is completed or the value is pending?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

First you'll need to make an equality helper if you aren't already using one:

Handlebars.registerHelper({
  eq: (v1, v2) => v1 === v2,
});

Then use it in the loop:

{{#each files}}
  <tr style="{{if (eq "Completed" status) "color:green"}} {{if (eq "Pending" status) "color:yellow"}}">
    <td>{{filename}}</td>
    <td>{{status}}</td>
  </tr>
{{/each}}
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!