2011-04-25 25 views

回答

2

你可以通過jQuery檢查提交...

$('form').submit(function(event) { 

    // These are the values returned by AutoComplete 
    var matches = ['a', 'b', 'c']; 

    // Assuming Array.indexOf(), otherwise extend the prototype 
    if (matches.indexOf($('input').val() == -1) { 
     event.preventDefault(); 
    } 

}); 

請記住,這僅僅從提交停止一個JavaScript啓用的用戶。禁用它的用戶將提交它就好了。

+0

@Nikita如果他們不能在輸入字段中輸入文本,會自動完成工作嗎? – alex 2011-04-25 02:35:46