dzenlife
4/12/2018 - 9:14 AM

Search js By Data-id

var containerItem = '[' + dataNameItem + ']';
var idInputSearch = '#search';

$('body').on('change keyup keydown', idInputSearch, function () {
    var searchData = '',
            value = $(this).val();
    $(containerItem).removeClass('hidden');
    
    if (value && value != '0') {
        var searchValue = value;

        searchValue = searchValue.toLowerCase();

        dataValue = '[data-title' + '*="' + searchValue + '"]';
        searchData = searchData + dataValue;
    }
    
    if (searchData) {
        $(containerItem).not(searchData).addClass('hidden');
    }
});