Skip to content

Instantly share code, notes, and snippets.

@avuenja
Created December 4, 2015 17:18
Show Gist options
  • Save avuenja/c483b1b59a150d253edc to your computer and use it in GitHub Desktop.
Save avuenja/c483b1b59a150d253edc to your computer and use it in GitHub Desktop.
Coordenates "mask"
var coords = document.querySelectorAll('[data-coordenada]');
var length = coords.length;
for (var i = 0; i < length; i++) {
coords[i].addEventListener('keyup', function(event) {
var value = this.value.replace(/[^\d-\.]/g, "");
this.value = value;
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment