dimanche 12 février 2017

Search multiple strings in sentences

Vote count: 0

I try to search "ego d16" in a list like

  1. ego fara d16
  2. ego d16
  3. ego d22
  4. d16 ego
  5. para ego dela d16

Must result in lines (1, 2, 4, 5)...

My code is

var filter = $(this).val(); //like 'ego d16'
$("#rezultate li").each(function () {
    if ($(this)[0].getAttribute('tags').toLowerCase().search(new RegExp(filter, "i")) < 0) {
        $(this).hide();
    } else {
        $(this).show()
    }
});

My actual result is only line (2)

How i can fix this? Thanks!

asked 1 min ago

Let's block ads! (Why?)



Search multiple strings in sentences

Aucun commentaire:

Enregistrer un commentaire