项目实训的搜索框进行回车搜索需要实现
This commit is contained in:
parent
0c52c0c6ea
commit
93a6be36e8
|
|
@ -125,7 +125,7 @@
|
|||
<input type="text" class="searchinput" name="search" placeholder="请输入实训名称的关键字进行搜索"/>
|
||||
<i class="fa fa-close mr5 color-light-grey" onclick="colse_searchbox();" title="搜索"></i>
|
||||
</div>
|
||||
<i class="fa fa-search mr5 color-light-grey search_icon" style="margin:10px" title="搜索"></i>
|
||||
<i class="fa fa-search mr5 color-light-grey search_icon" onclick="search_shixun()" style="margin:10px" title="搜索"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -278,6 +278,37 @@
|
|||
}
|
||||
})
|
||||
});
|
||||
|
||||
$(".searchCon").on("keydown", "input[name='search']", function(event){
|
||||
var target, code, tag;
|
||||
if (!event) {
|
||||
event = window.event; //针对ie浏览器
|
||||
code = event.keyCode;
|
||||
}
|
||||
else {
|
||||
code = event.keyCode;
|
||||
}
|
||||
if(code == 13) {
|
||||
search_shixun();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
//搜索实训
|
||||
function search_shixun(){
|
||||
if($(".searchCon").is(":visible")){
|
||||
$.ajax({
|
||||
url: '/shixuns/search',
|
||||
type: 'post',
|
||||
data: $("#shixun_index_search_form").serialize(),
|
||||
remote: true,
|
||||
success: function(data){
|
||||
}
|
||||
});
|
||||
} else{
|
||||
$(".searchCon").show();
|
||||
}
|
||||
}
|
||||
//关闭搜索框
|
||||
function colse_searchbox(){
|
||||
$('.searchCon').hide();
|
||||
|
|
|
|||
Loading…
Reference in New Issue