Created
April 3, 2017 04:52
-
-
Save temazinkin/9e1517274a27fe78f005c46c2e58a47a to your computer and use it in GitHub Desktop.
Поиск по списку без учета регистра
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(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