I have a function with JQuery that leaves the textbox in uppercase, the problem is that when I have a mask in the field, after typing any character, the cursor goes to the end of the textbox, then the user has to go back and type again, and the cursor returns to the end, this only happens in fields with masks, follow the function.
jQuery(document).ready(function ($) {
// Chamada da funcao upperText(); ao carregar a pagina
upperText();
// Funcao que faz o texto ficar em uppercase
function upperText() {
// Para tratar o colar
$(":input").bind('paste', function (e) {
var el = $(this);
setTimeout(function () {
var text = $(el).val();
el.val(text.toUpperCase());
}, 100);
});
// Para tratar quando é digitado
$(":input").keypress(function () {
var el = $(this);
setTimeout(function () {
var text = $(el).val();
el.val(text.toUpperCase());
}, 100);
});
}
});