I have a form and need to focus on an input again until it satisfies the required, eg:
$('#text1').blur(function() {
var teste = $('#text1').val().length;
console.log(teste);
if(teste > 5){
$('#text1').focus();
}else{
$('#text2').focus();
}
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><label>Input1:<inputtype="text" name="text1" id="text1">
</label>
<br><br>
<label>
Input 2:
<input type="text" name="text2" id="text2">
</label>
Is it possible to do this?