2012-01-22 29 views

回答

1

你可以訂閱.keypress()活動形式,並取消它,如果它是輸入:

$(function() { 
    // subscribe to the keypress event of the form 
    $('form').keypress(function(e) { 
     if (e.which == 13) { 
      // if Enter was pressed cancel the default action and 
      // prevent the form from submitting 
      return false; 
     } 
    }); 
}); 
+0

這是非常好的劇本...謝謝非常多..... –

+0

@LakhbirChandel,如果這篇文章幫您解決您遇到的問題,確保你[將其標記爲答案】(http://meta.stackexchange.com/questions/5234/how-does-接受-AN-通過點擊旁邊的蜱回答工作)。 –

相關問題