Skip to content

Instantly share code, notes, and snippets.

@temazinkin
Created April 3, 2017 04:52
Show Gist options
  • Save temazinkin/9e1517274a27fe78f005c46c2e58a47a to your computer and use it in GitHub Desktop.
Save temazinkin/9e1517274a27fe78f005c46c2e58a47a to your computer and use it in GitHub Desktop.
Поиск по списку без учета регистра
$(document).ready(function(){
$.expr[":"].Contains = $.expr.createPseudo(function(arg) {
return function( elem ) {
return $(elem).text().toUpperCase().indexOf(arg.toUpperCase()) >= 0;
};
});
$('#search').val('');
$('#search').keyup(function(e) {
var inputValue = $.trim($(this).val()).toLowerCase()
, $menuElements = $('.task-list a')
;
if (inputValue != '') {
$('.task-list a:Contains("' + inputValue + '")').slideDown();
$('.task-list a:not(:Contains("' + inputValue + '"))').slideUp();
} else {
$menuElements.slideDown();
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment