javascript - Maxlength and copy paste in Cordova/PhoneGap Android Apps -
i using maxlength in cordova based android app. have implemented maxlength using code-
$('.limit-eight').keyup(function(e) { if (e.keycode != 8 || e.keycode != 46) { if ($(this).val().length >= 8) { $(this).val($(this).val().substr(0, 8)); } } });
but whenever user copies , pastes, text pastes without restriction.
attach on paste event
$('.limit-eight').on('paste', function() { // logic here console.log('text pasted!') })
Comments
Post a Comment