last day (20 days later) » 

8:56 PM
0
A: Check if row contains string

warkentien2 First get all tds to filter $("#"+ tableID +" tr td") if you test searchString.toLowerCase) here, it'll only grab lower-cased td. loop through them with .each(function() { }); test if $(this).text().toLowerCase().indexOf(searchString) >= 0 and remove parent $(this).parent().remove(); code: r...

 
@JonSG well depends on the logic: If he is testing if a larger td.text() has somewhere a searchString keyword in it.. my logic is correct. w3schools.com/jsref/jsref_indexof.asp.
 
forEach isn't a function
 
@BrandonStewart it's an array function. works with pure JavaScript. I changed it back to .each
@JonSG thanks. Fixed it
 
No more errors, but if I do removeRows("uglybillingtable", "account"); it removes every single row in the table
 
@BrandonStewart do all rows have an "account" written in them somewhere?
 
8:56 PM
@warkentien2 only 2/1421 rows have the text "Account" in them.
 
@BrandonStewart I added a snippet to prove that it's working as expected. If you could share your code, we could help out spotting the actual problem.
 
Hey friends
 
hey
I'm beggining to think you only have 1 tr and multiple tds.. this code is to remove tr.. to remove td just use $(this).remove()
 
@warkentien2, I just added a note about updating your method to support mixed cases in the search term
 
I'll chec
check*
 
8:58 PM
I am not sure if that is a requirement or not.. It seems like it might make sense to support it
 
I updated the code, to be completely case insensitive
 
cool
I put in a version that does a deep or shallow search for text
I am wondering if the <td> elements in question might have children in them and that text() causing a search over more content than @BrandonStewart thinks
or potentially, your guess about a single TD (with a table of real content) might be messing things up
 
you could be right. without a code, there's so much me can guess
 
@BrandonStewart, if you see this it would probably be very helpful if we could see at least a partial version of your table
 

  last day (20 days later) »