From 9e12f260b8eda68f2b8ac5fd5519763cdec57d54 Mon Sep 17 00:00:00 2001 From: anton_yu Date: Fri, 2 May 2014 10:21:17 +0800 Subject: [PATCH] =?UTF-8?q?=09tab=20=E8=B7=9F=E6=96=B9=E5=90=91=E9=8D=B5?= =?UTF-8?q?=E5=8F=B3=E9=8D=B5=E9=83=BD=E5=8F=AF=E4=BB=A5=E8=87=AA=E5=8B=95?= =?UTF-8?q?=E8=A3=9C=E5=AE=8C,=20tab=20focus=20=E7=9A=84=E5=95=8F=E9=A1=8C?= =?UTF-8?q?=E5=85=88=E7=94=A8=20work-around=20=E4=BE=86=E8=A7=A3=E6=B1=BA?= =?UTF-8?q?=EF=BC=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/js/cell.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/static/js/cell.js b/static/js/cell.js index c813978..0276c6a 100644 --- a/static/js/cell.js +++ b/static/js/cell.js @@ -122,10 +122,17 @@ $(document).ready(function(){ // 按 tab 鍵補完 var ans_ac_keydown = function(e) { var ans_shadow = $('#ans-shadow').val(); - if (e.which == 9 && ans_shadow !== "" && ans_shadow !== $('#ans').val()) { + + if (ans_shadow == "" || ans_shadow == $('#ans').val()) + return; + // Both tab or arrow right will autocomplete */ + if (e.which == 9 || e.which == 39) { $('#ans').val($('#ans-shadow').val()); e.preventDefault(); } + // work around to return focus + if (e.which == 9) + setTimeout('$("#ans").focus();$("#ans").select();', 300); } // 找出自動完成