Advertisement
silentvoice

Поиск по точному совпадению(индексы)

Feb 25th, 2021
808
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $(document).ready(function(){
  2.     $("#city_search").keyup(function(){
  3.         var _this = this;
  4.         var l = _this.value.length
  5.         $.each($(".city_ul_list a"), function() {
  6.             var part_len = $(this).text().toLowerCase().split('').slice(0,l).join('');
  7.             if(part_len !== _this.value.toLowerCase()) {
  8.                 $(this).parent().hide();
  9.             } else {
  10.                 $(this).parent().show();
  11.             }              
  12.         });
  13.     });
  14. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement