<form id="myform">
<input type="search" id="searchText" th:value="${searchText}" autocomplete="off"><a id="searchBtn" onclick="searchFun()"></a>
</form>
html禁用input在输入时自动弹出自带的下拉框
绑定输入法搜索 输入框必须在from中
$("#myform").bind('search', function () {
var text = $("#searchText").val();
// location.href="/HongYun/list?videoTitle="+text;
location.href = "/list?videoTitle=" + text;
});
去除 后面的 X号
<style>
input[type="search"]::-webkit-search-cancel-button{
display: none;
autocomplete:off;
}
</style>
输入框 密码类型 绑定方法
<from id="myform">
<h2>登录</h2>
<div><img src="img/ico_01.png" width="24" height="30" alt=""/>
<p><input type="search" name="name" placeholder="请输入账号"></p></div>
<div><img src="img/ico_02.png" width="24" height="30" alt=""/>
<p><input type="password" id="pwd" name="pwd" placeholder="请输入密码"></p></div>
<input class="dlu_but" type="button" id="submitBtn" value="确认">
</from>
$('#myform').bind("keydown",function (e) {
if(13 === e.keyCode) {
var name= $("input[name='name']").val();
var pwd = $("input[name='pwd']").val();
$.post("/login",{name:name,pwd:pwd},function(data){
if(data.code == '000000'){
window.location.href="/iteamList";
}else{
alert(data.message);
}
});
}
})