WebmasterBR Desenvolvimento de Site
  • Home
  • Desenvolvimento de sites
  • Quem Somos
  • Portifolio
  • Contato
  • Códigos
30 de novembro de 2020 por Alessandro Jonas

Validar CPF Jquery

Validar CPF Jquery
30 de novembro de 2020 por Alessandro Jonas

<script src=”https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js”></script>
<script>

$(document).ready(function() {

$(“#id_submitbutton”).focus(function(){

var strCPF = document.getElementById(“id_profile_field_CPF”);

function TestaCPF(strCPF) {

var Soma;
var Resto;
Soma = 0;
if (strCPF == “00000000000”) return false;

for (i=1; i<=9; i++) Soma = Soma + parseInt(strCPF.substring(i-1, i)) * (11 – i);
Resto = (Soma * 10) % 11;

if ((Resto == 10) || (Resto == 11)) Resto = 0;
if (Resto != parseInt(strCPF.substring(9, 10)) ) return false;

Soma = 0;
for (i = 1; i <= 10; i++) Soma = Soma + parseInt(strCPF.substring(i-1, i)) * (12 – i);
Resto = (Soma * 10) % 11;

if ((Resto == 10) || (Resto == 11)) Resto = 0;
if (Resto != parseInt(strCPF.substring(10, 11) ) ) return false;
return true;
}

var cpf = strCPF.value;
var valida_cpf = (TestaCPF(cpf));

if(valida_cpf == false){

alert(“CPF Invalido”);
//window.location.href = “https://ava.fundacaocasa.sp.gov.br/login/signup.php”;
document.getElementById(“id_profile_field_CPF”).value = “”;

}

if(valida_cpf == true){
//alert(“CPF Valido”);
//alert(cpf);
}

});
});

</script>

Artigo anteriorGerar Senha (string aleatória)Próximo artigo PHP - MySQLi

Deixe uma resposta Cancelar resposta

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *

About The Blog

Nulla laoreet vestibulum turpis non finibus. Proin interdum a tortor sit amet mollis. Maecenas sollicitudin accumsan enim, ut aliquet risus.

Posts recentes

Adicionar Charset na Conexão String SQL Server PHP14 de dezembro de 2020
PHP – Charset – SQLServer – Convert caracteres para UTF-814 de dezembro de 2020
PHP – MySQLi12 de dezembro de 2020

Categorias

  • JavaScript
  • Jquery
  • Lifestyle
  • Linux
  • MySQLi
  • News
  • Others
  • People
  • PHP
  • Post
  • SQLServer
  • WebmsaterBrCódigo
  • WordPress

Meta

  • Acessar
  • Feed de posts
  • Feed de comentários
  • WordPress.org

Tags

Agency Apache Apollo13 compartilha psta Digitar apenas números Information Mysql passwd password PHP PHPMyAdmin Popular Validar CPF Validar Email Vlaidar CPF WordPress

Contato

Rua José Bonifacio, Vila Zanela
Franco da Rocha – São Paulo
Fone: 11 99795-3191 | 11 4819-1505

Email: [email protected]
11 99795-3191
11 4819-1505
contato@webmasterbr.com.brhttps://webmasterbr.com.br
Seg. - Sexta. 8:00 - 18:00
Rife Wordpress Theme. Proudly Built By Apollo13

About This Sidebar

You can quickly hide this sidebar by removing widgets from the Hidden Sidebar Settings.

Posts recentes

Adicionar Charset na Conexão String SQL Server PHP14 de dezembro de 2020
PHP – Charset – SQLServer – Convert caracteres para UTF-814 de dezembro de 2020
PHP – MySQLi12 de dezembro de 2020

Categorias

  • JavaScript
  • Jquery
  • Lifestyle
  • Linux
  • MySQLi
  • News
  • Others
  • People
  • PHP
  • Post
  • SQLServer
  • WebmsaterBrCódigo
  • WordPress

Meta

  • Acessar
  • Feed de posts
  • Feed de comentários
  • WordPress.org