Question:
How to get status by add rows dynamic in javascript?

Here the javascript code to get status by add rows dynamically:

// Get a list of all the rows in the table

const table = document.querySelectorAll('table#table-id tr');

// For each row in the table

for (const row of table) {

    // call the sum_method function, providing the row

    sum_method(row);

}



// Run the check on a specific row

function sum_method(row) {

    // Get the result *from the row*

    var result = parseInt(row.querySelector('[name="result"]').value);

    var value_from = parseInt(row.querySelector('[name="value_from"]').value);

    var value_to = parseInt(row.querySelector('[name="value_to"]').value);


    if (value_from <= result && result <= value_to) {

        row.querySelector('[name="status"]').value = 'pass';

    } else {

        row.querySelector('[name="status"]').value = 'fail';

    }

}


Suggested blogs:

>Guide: Building a responsive Flutter Web- Part 2

>Why does my Vue.js compile render function not work?

>How to integrate AI agents into your existing ecosystem?

>7 Best Open Source Libraries for Artificial Intelligence

>Guide: Building a responsive Flutter Web- Part 1

>Firebase Authentication in Flutter

>How to change the layout depending on values in the store?

>How can I show 3 items per row in Vuejs?

>What makes index.html have such kind of name in Django?

>Fix Module Not Found Error in Django


Ritu Singh

Ritu Singh

Submit
0 Answers