Note: validate letter by letter and work well, but the problem is when the user pastes the data with numbers and letters I only have to receive a string of 11 digits, but when I put a letter it passes the validations that I have, how do I solve it?
I decided to make a parse and validate that it is a number but the data is truncated and if it passes as a numeric
Here my code
function buscarCuenta()
{
//alert("buscar cuenta");
id ="num_credito";
var valor = document.getElementById(id).value;
var valor2=getCookie("num_credito");
var n = valor.length;
alert(valor);
if (valor.localeCompare(valor2)!=0)
{
if(n==11)
{
var a = parseInt(valor);
alert(a);
if(Number.isInteger(a)==false)
{
alert("No es un numero valido Verificar");
//document.getElementById(id).value = "";
}
if(Number.isInteger(a)==true)
{
setCookie("num_credito", valor);
putLoader();
var url="php/core.php";
var values="Opcion=buscarTasa";
$.ajax({
type: "POST",
url:url,
data:values,
success: function(datos){
$('#listaPendientes').html(datos);
}
});
//buscarCuenta();
}
}//fin del if
}//fin 2 if
// alert("Credito repetido");
}