2011-09-27 29 views

回答

6

像這樣:

$('.yourinputclass').keypress(function(e) { 
    if(e.which == 38 or e.which == 40) return false; // or you can use e.preventDefault(); like it was mentioned in the comments 
}); 

文檔here

+2

或使用[preventDefault()方法(http://api.jquery.com/event.preventDefault/),而不是返回假 – epascarello

+0

我同意preventDefault更清晰 –

相關問題