h5中的input keyup触发事件在ios中需点击键盘换行才执行

var bname = 'input';
        if (navigator.userAgent.indexOf("MSIE") != -1) {
         bname = 'propertychange';
        }
        if(navigator.userAgent.match(/android/i) == "android")
        {
         bname = "keyup";
        }
        $('#fanxsearch').bind(bname, function(){
            var val = $.trim($(this).val());
            if(val&&val!=''){
                $('.fanxdatalist>div').each(function(){
                    var dname = $(this).attr('data-name');
                    console.log('tttt  '+dname.indexOf(val));
                    if(dname.indexOf(val)>=0){
                        $(this).css('display','block');
                    }else{
                        $(this).css('display','none');
                    }
                })
            }else{
                $('.fanxdatalist>div').css('display','block');
            }
        });

 

转载于:https://www.cnblogs.com/zhang-2052975439/p/8269600.html

你可能感兴趣的:(移动开发,javascript)