我有一個窗體上的jQueryUI按鈕(不是模態對話框)。我想在用戶點擊Enter鍵時觸發它。我怎樣才能做到這一點?這裏是我的代碼:jQueryUI按鈕上的默認按鈕上按Enter鍵
HTML:
<a href="javascript:void(0);" id="loginButtonInner">Login</a>
JS:
$(document).ready(function()
{
$("#loginButtonInner").button(getButtonOptions("ui-icon-unlocked", true));
$("#loginButtonInner").button("option", "disabled", true);
$("#loginButtonInner").unbind("click");
}
....
if (userNameValid && passwordValid)
{
$("#loginButtonInner").button("option", "disabled", false);
$("#loginButtonInner").unbind("click").bind("click", function() { authenticateUser(); return false; });
}
else
{
$("#loginButtonInner").button("option", "disabled", true);
$("#loginButtonInner").unbind("click");
}
目前,我必須標籤通過鍵盤來達到按鈕或通過鼠標點擊。
我在網上搜索解決方案,但他們都指向一個模式對話框窗體按鈕。
謝謝!
謝謝你們!我會嘗試這兩個選項!非常感激。 :) – user1100221 2012-03-12 02:47:58