html
<input type="search" class="input">
js
let keyword = document.getElementsByName('input')[0]
keyword.onkeypress = function (e) {
let keycode = e.which || e.keyCode
if (keycode === 13) {
e.preventDefault()
}
}
使用css3新增的屬性來控制 input[type=search]
的叉子
input-placeholder
search-cancel-button
input::-webkit-input-placeholder
input::-webkit-search-cancel-button