0
Hi, I found a site where you mark and validate the CPF and CNPJ Link.
I’m testing, but it doesn’t seem to work. I’m doing it wrong or have some problem in the original code?
$(document).ready(function() {
$('.validate').cpfcnpj({
mask: true,
validate: 'cpfcnpj',
event: 'click',
//validateOnlyFocus: true,
handler: '.btn',
ifValid: function(input) {
input.removeClass("error");
alert(returnType);
},
ifInvalid: function(input) {
input.addClass("error");
alert(returnType);
}
});
});
.error {
border-color: #F70202
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://igorescobar.github.io/jQuery-Mask-Plugin/js/jquery.mask.min.js"></script>
<script src="https://github.com/gmgomess/jQuery-CPF-CNPJ-Validator-plugin/blob/master/jquery.cpfcnpj.js"></script>
<input type="text" class="validate" />
<input type="button" class="btn" value="Test" />
Yes it works, you need to download javascript for your machine and use it locally, it will run smoothly, the address does not work.
– novic