我面臨Android中的一個問題,就像我每次在輸入時使用maxlenth屬性一樣, ;在Android標籤上輸入20個字符後,該頁面變爲掛起狀態,我無法刪除任何內容或添加任何其他輸入內容,其他頁面可以正常工作,但不是我輸入字符的頁面達到最大限制無法在Android中使用maxlength JellyBean
我正在使用上KArbonn智能選項卡8 Android果凍豆
我面臨Android中的一個問題,就像我每次在輸入時使用maxlenth屬性一樣, ;在Android標籤上輸入20個字符後,該頁面變爲掛起狀態,我無法刪除任何內容或添加任何其他輸入內容,其他頁面可以正常工作,但不是我輸入字符的頁面達到最大限制無法在Android中使用maxlength JellyBean
我正在使用上KArbonn智能選項卡8 Android果凍豆
這是一個衆所周知的Android 4.1問題。
Jelly Bean WebView not working well with HTML maxlength attribute for text box
http://code.google.com/p/android/issues/detail?id=35264
不幸的是,沒有修復呢。你可以按照上面的堆棧溢出帖子,他們有一個JS修復。
我已經找到了答案,它爲我工作:
x$("#fieldWithMaxLength").on("keydown", function(e) {
if(e.keyCode != 8) {
maxlength = $(this).attr('maxlength');
if(this.value.length >= maxlength) {
var curIndex = $(this).attr('tabindex');
$('[tabindex=' + curIndex + ']').focus();
return false;
}
}
});