bishawjit-das
1/21/2016 - 12:01 PM

jQuery non case sensitive div search

jQuery non case sensitive div search

  $.extend($.expr[":"], {
    "containsIN": function(elem, i, match, array) {
      return (elem.textContent || elem.innerText || "").toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0;
    }
  });

  // filter proflie
  $('#search-profile').keyup(function () {
    var txt = $(this).val();
    $('.profile-data .col-md-4:not(:containsIN("'+txt+'"))').fadeOut();
    $('.profile-data .col-md-4:containsIN("'+txt+'")').fadeIn();
  });
  
  // ContainsIn can be contains