Skip to content

Instantly share code, notes, and snippets.

@samirbr
Last active January 27, 2016 17:42
Show Gist options
  • Save samirbr/50efeef481a07f167f19 to your computer and use it in GitHub Desktop.
Save samirbr/50efeef481a07f167f19 to your computer and use it in GitHub Desktop.
var $input = $('#id_cpf');
$input[0].sent = false;
$input.keyup(function () {
var value = $(this).val();
if (value.length === 11 && !this.sent){
this.sent = true;
$.ajax({ /* ajax goes here */ });
} else if (value.length < 11) {
this.sent = false;
} else {
this.sent = true;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment