0

The following line works. When I typed ID 22 in my search field, it shows all rows containing 22, which include 2212, 8922...

$('#patientTable .ID:not(:contains("' + sID + '"))').parent().hide();

Now I want to hide all rows except the one with exact match. I tried the following code. It returns nothing. Please help.

$('#patientTable .ID:not(sID)').parent().hide();
Tyler Roper
  • 21,445
  • 6
  • 33
  • 56
4green
  • 11
  • 1
  • can you provide a sample of your table and a sample output of sID? – ad_on_is Apr 11 '17 at 20:11
  • Possible duplicate of [Select element by exact match of its content](http://stackoverflow.com/questions/15364298/select-element-by-exact-match-of-its-content) – DaniP Apr 11 '17 at 20:12
  • 1
    You can't just include a variable in a string - you need to concatenate, just as you have in your first example. In this particular case, you can't exact-match using your proposed syntax, but consider it food-for-thought moving forward. – Tyler Roper Apr 11 '17 at 20:13
  • The sID is a unique key in the table. There is no duplicates. What syntax can I use for exact-match? – 4green Apr 11 '17 at 20:30
  • Check the link I post as possible duplicate – DaniP Apr 11 '17 at 20:30

0 Answers0