Include Option / Select in search

0

Good afternoon guys, I'd like to include the option for my search, I've already tried it:

var $search = $("#search").on('input, option',function(){
        $btns.removeClass('active');
        var matcher = new RegExp($(this).val(), 'gi');
        $('.box').show().not(function(){
            return matcher.test($(this).find('.name, .sku, .local').text())
        }).hide();
    })

But I did not succeed.

    
asked by anonymous 19.06.2018 / 20:59

1 answer

-1

Change this line

var matcher = new RegExp($(this).val(), 'gi');

by

var matcher = new RegExp(this.value, 'gi');

and the line

var $search = $("#search").on('input, option',function(){

by

$('#search').on('change', function () {
    
20.06.2018 / 03:57