美文网首页
h5实现软键盘搜索功能

h5实现软键盘搜索功能

作者: 真是个非常帅气的昵称呢 | 来源:发表于2020-08-17 09:45 被阅读0次
    //必须带上action
                <form action=""  id="form">
                <div>
                    <span class="icon-search"></span>
                    <input type="search" value="" placeholder="找不到?不妨搜一下..." id="searchTxt">
                    <span id="delete"></span>
                </div>
                </form>
    
    
            $("#form").submit(function(e){
                e.preventDefault();//阻止默认刷新
                keyword=$('#searchTxt').val()
                if($('#searchTxt').val().length>0){
                    $('#search-list').html('')
                    $('#search-list-box').show()
                    $('#wrapper').hide()
                    pageSearch=1
                    getSearchList()
                    console.log('search click')
                }
            })
    
    input:-internal-autofill-previewed,
    input:-internal-autofill-selected {
        -webkit-text-fill-color: #FFFFFF !important;
    }
    //去除默认样式
    input[type="search"]::-webkit-search-cancel-button{
        -webkit-appearance: none;
    }
    

    相关文章

      网友评论

          本文标题:h5实现软键盘搜索功能

          本文链接:https://www.haomeiwen.com/subject/gjmfjktx.html