1
Good night. I am developing an application (Cordova), that the user has to register an initial code with 2 (two) letters, 14 (fourteen) numbers and more 2 letters.
I was able to make the input change to numeric when it reaches the second letter, but the keyboard doesn’t change the type of data. I gave a . Blur() and a . Focus(), but the keyboard does not reappear.
Any suggestions?
var espaco = 0;
$('#numeroOS').keyup(function(e) {
if (e.keyCode == 8 || e.keyCode == 46) {
espaco = 0;
$('#numeroOS').val("");
}
var text = $('#numeroOS').val();
if (text[text.length - 1] != ' ') {
text.length - espaco;
} else {
espaco++;
}
if (text.length == 2){
$('#numeroOS').prop('type', 'tel');
$('#numeroOS').blur();
setTimeout(function(){
$('#numeroOS').focus();
},100);
} else {
$('#numeroOS').prop('type', 'text');
}
instead of just giving the Blur, you tried to focus on another element and then return to your input?
– Leandro Angelo
I didn’t try this not, but something I saw, that focusing on the element, does not open the keyboard.
– Guilherme Lirio