How can I delete rows that has no Activity & no $ in JavaScript(Yellow Colored Rows)?
I have a HTML table with 800 rows. How can I delete rows that has no Activity & no $ in JavaScript(Red Colored Rows)? Please note I can have 1 or more than 1 assessments with 1 or more than 1 activity. Sample data.
Name Address Assessment Activity $
Bela Toronto First Assessment Activity 1 10
Asif Toronto First Assessment
Asif Toronto First Assessment Activity 1 10
Asif Toronto First Assessment Activity 2 10
Asif Toronto First Assessment Activity 3 20
Asif Toronto First Assessment Activity 4 30
Asif Toronto Second Assessment
Asif Toronto Second Assessment Activity 1 10
Asif Toronto Second Assessment Activity 2 10
Asif Toronto Second Assessment Activity 3 10
Akhtar Toronto First Assessment
Akhtar Toronto First Assessment Activity 1 20
Akhtar Toronto First Assessment Activity 2 30
Akhtar Toronto First Assessment Activity 3 10
Akhtar Toronto First Assessment Activity 4 10
Akhtar Toronto First Assessment Activity 5 10
You could try document.getElementById(rowId).firstchild.nodeValue or .data or if those don't work, document.getElementById(rowId).innerHTML to get the row as a string.
Then you have some options, personally I would probably use regex to search for any numbers within that string or you could do a simple search for the last index of numbers and if nothing comes back then use something like document.getElementById(rowId).parentNode.removeChild and it will delete the row.
This assumes that your rows are inside of their own <span>'s or <p>'s or something. Posting code would help.
Bookmarks