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

193
Views
How do I make a cell item of a table row bold for n seconds?

I have a piece of code where I am calling my server to fetch some values and update the table if that value isn't present there. After the updation, I want the user to be notified of the row where the value was updated, by making it's cell value bold for n seconds.

var table=document.getElementById("employee_details");

var jsonString = JSON.stringify(array);

$.ajax({
    url: '/server.php',
    type: 'POST',
    data: {"input":"calculate_charges",
           data:jsonString},
    cache: false,
    success:function(response){

        const arr3=JSON.parse(response);

        for(var i=0; i<arr3.length; i++){

            if(table.rows[i+1].cells.item(10).innerHTML!=arr3[i][2]){

                 table.rows[i+1].scrollIntoView({
                     behavior: 'smooth',
                     block: 'center'
                 });

                 table.rows[i+1].cells.item(10).innerHTML=arr3[i][2];

                 setTimeout(function(){
                       table.rows[i+1].cells.item(10).style.fontWeight = "500";
                 },7000);

                 setTimeout(function(){
                       table.rows[i+1].cells.item(10).style.fontWeight = "900";
                 },4000);
            }
        }
    }
    complete:function(){}
});

Upon executing the code, I keep getting this error in the console:

Uncaught TypeError: Cannot read properties of undefined (reading 'cells')

And the cell item doesn't get bold. How do I fix this issue?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Use let in for loop:

for(let i=0; i<arr3.length; i++){

About let: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/let

over 4 years ago · Santiago Trujillo 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!