js函数节流
This commit is contained in:
parent
f25015c6b8
commit
5652a60c68
|
@ -557,6 +557,17 @@
|
|||
// });
|
||||
//查询学校
|
||||
$("input[name='province']").on('input', function (e) {
|
||||
throttle(shcool_search_fn,window,e);
|
||||
});
|
||||
|
||||
function throttle(method,context,e){
|
||||
clearTimeout(method.tId);
|
||||
method.tId=setTimeout(function(){
|
||||
method.call(context,e);
|
||||
},500);
|
||||
}
|
||||
|
||||
function shcool_search_fn(e){
|
||||
$("input[name='occupation']").val(''); //一旦有输入就清空id。
|
||||
if($(e.target).val().trim() == lastSearchCondition && $(e.target).val().trim() != ''){
|
||||
return;
|
||||
|
@ -592,7 +603,7 @@
|
|||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
$(document.body).click(function(e){
|
||||
if($(e.target).attr("id") != 'search_school_result_list' && $(e.target).attr("id") != 'province')
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue