Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where TD Does Not Contain Text

Tags:

jquery

I'm getting magical with some data filtering. When hitting a drop down list I want to eliminate rows from a table where a certain column does not contain the text from the drop down list. I've tried various combinations without any luck as follows:

$("table tr td:contains('" + $("#SupplierID :selected").text() + "')").parent().hide();

This obviously hides the ones that do contain the selected text. I've tried not:contains but that doesn't work at all. So yeah, I want to do the inverse of this. And can I do it for a certain column? There's no point going through all the columns as it only applies to one column.

Cheers!

like image 363
Kezzer Avatar asked Dec 08 '22 05:12

Kezzer


2 Answers

You can do it like this:

$("table tr td:nth-child(...):not(:contains(...))")
like image 143
Greg Avatar answered Dec 09 '22 18:12

Greg


:not(:contains("text"))

Is what you need

like image 44
meder omuraliev Avatar answered Dec 09 '22 19:12

meder omuraliev