From 5652a60c6885b0b59aa8873cfd396a5c19ec2eb5 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Mon, 19 Oct 2015 09:55:19 +0800 Subject: [PATCH] =?UTF-8?q?js=E5=87=BD=E6=95=B0=E8=8A=82=E6=B5=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/my/account.html.erb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erb index b439adaac..4a2fe446d 100644 --- a/app/views/my/account.html.erb +++ b/app/views/my/account.html.erb @@ -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') {