www.webdeveloper.com
Results 1 to 2 of 2

Thread: How can I delete rows that has no Activity & no $ in JavaScript(Yellow Colored Rows)?

  1. #1
    Join Date
    Feb 2009
    Posts
    95

    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

  2. #2
    Join Date
    May 2010
    Posts
    42
    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.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles