This question may be absurd but it does not work codes that I have found in searches
What I have is the following:
$(".nota").focusout(function(){
var tx = $(this).val();
if(tx.length == 2){
alert("El valor ingresado no debe terminar en un punto");
$(this).focus();
$(this).select();
}
});
The alert works fine, but the input does not change
Your code really does work, what you should do is change it
alert
to another way of displaying the message, in addition to the fact thatalert
it is no longer used, it generates problems with your code because when it is executed,if
it shows thealert
, itinput
recovers its focus and selects its content, but byclick
clicking on the accept button you would be exiting againinput
, which would repeat the entire process, generating onealert
that will never close.