一、鍵盤搜索按鈕
一定要用form包裹并且加上action屬性,這樣手機的鍵盤就會出現(xiàn)搜索按鈕。
<form id="SearchForm" action="">
<input id="searchInputId" type="search" value="" class="searchInput" placeholder="請輸入商品關鍵詞"/>
</form>
// 回車搜索
$("#SearchForm").submit(function(e){
e.preventDefault()
e.stopPropagation()
let searchVal = $("#searchInputId").val();
window.location.href = './shopList.html?name='+searchVal;
})
二、去掉ios自帶的搜索icon
由于input type 是 search发魄,所以ios會自帶一個搜索icon,安卓則沒有。所以最好自己寫一個 隱藏ios的icon
input[type="search"]{-webkit-appearance:none;}
input::-webkit-search-cancel-button {display: none;}
去掉前
去掉后