Aim : Disallow numeric values on an input Field
Logic: I am trying to replace every numeric value with empty string. But on every next keypress, the original val string is prepended to it.
For example :
---------------------------------------------------------
Key Entered | Value reflected in Input
---------------------------------------------------------
A | A
b | Ab
1 | Ab
c | AbAbc
----------------------------------------------------------
Code :
HTML
<input id="charText" value="" class="alpha">
Script
$('.alpha').on('keyup', function () {
//$(this).val( $(this).val().replace(/[^A-Za-z]/g,'') );
$val = $(this).val().replace(/[^A-Za-z]/g,'');;
$('.alpha').val($val);
});
});
Works for desktop. Error only in my Android mobile