JSFiddle - React, Tailwind, and code Playground
HTML
<input type="text" id="rut"/>
<p id="error12">sdfsd</p>
<input type="text" id="rut2"/>
<input type="text" id="rut3"/>
JavaScript
$(document).ready(function(){
$("#rut").blur(function(){
$('#error12').html("");
var Rut = $(this).val();
var RemoveDotInRut = Rut.split('.').join("");
var RemoveHypenInRut = RemoveDotInRut.split('-').join("");
var freshString = RemoveHypenInRut.length;
if(freshString<8 || freshString>9){
$('#error12').html("<?php echo $this->__('Please enter a valid Rut number.') ?>");
setTimeout(function(){
$("#rut").focus().val("");
}, 0);
}
});
});