Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

js filter text

<script>
    $('input[name="search_field"]').on("keyup", function() {
        filtrate($(this).val().toLowerCase());
    });

    function filtrate(searched) {
        $(".filter-key > h3").filter(function() {
            var isHidden = ($(this).text().toLowerCase().indexOf(searched) > -1) ? 'block' : 'none';
            $('.filter-key').css('display', isHidden);
        });
    }
</script>
Comment

filter text js

$(document).ready(function(){
    var $btns = $('.btn').click(function() {
        if (this.id == 'all') {
          $('#parent > div').fadeIn(450);
        } else {
          var $el = $('.' + this.id).fadeIn(450);
          $('#parent > div').not($el).hide();
        }
        $btns.removeClass('active');
        $(this).addClass('active');
      })
    
    var $search = $("#search").on('input',function(){
        $btns.removeClass('active');
        var matcher = new RegExp($(this).val(), 'gi');
        $('.box').show().not(function(){
            return matcher.test($(this).find('.name, .skills').text())
        }).hide();
    })
})
Comment

PREVIOUS NEXT
Code Example
Javascript :: react hook form example stack overflow 
Javascript :: javascript arrow functions to create methods inside objects 
Javascript :: difference between js and jsx 
Javascript :: req.params 
Javascript :: jquery datatable server side pagination asp.net core 
Javascript :: javascript xpath 
Javascript :: angular formatting numbers with -commas 
Javascript :: jsdoc object destructuring 
Javascript :: promise.all in javascript 
Javascript :: basic json syntax 
Javascript :: login with facebook expo react native 
Javascript :: update state in useState hook 
Javascript :: javascript sorting an array 
Javascript :: regex number 
Javascript :: how to uninstall nodejs web server 
Javascript :: angular inner page in refresh 404 after ng build 
Javascript :: routes in angular 
Javascript :: use two div id in jquery 
Javascript :: javascript function return 
Javascript :: how to perform transaction with sequelize 
Javascript :: Vowel Count 
Javascript :: mobile detect js 
Javascript :: react native cli sdk.dir 
Javascript :: update nested formgroup angular 
Javascript :: javascript reduce method stack overflow 
Javascript :: node js how to basic auth to specific urk 
Javascript :: react native add react native vector icons not working 
Javascript :: mongoose max record 
Javascript :: how to use location.pathname 
Javascript :: javascript regex insert string 
ADD CONTENT
Topic
Content
Source link
Name
6+8 =