Can't use maxlength in Android JellyBean

I am facing a problem in Android that is similar when I use the maxlenth attribute on the input eg .; After entering 20 characters in Android tab, this page freezes, I cannot delete or add anything on any other input, other pages work fine, but not on this page where I entered characters with the maximum limit

I am using KArbonn Smart Tab 8 Android JellyBean

+3


source to share


2 answers


This is a well known issue with Android 4.1.

Jelly Bean WebView does not perform well with HTML maxlength attribute for textbox



http://code.google.com/p/android/issues/detail?id=35264

Unfortunately, there is no fix yet. You can follow the above column where they have a JS fix.

+2


source


I found the answer and it works for me:



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;
                }
            }
        });

      

+1


source







All Articles