Created
June 26, 2014 19:55
-
-
Save maccevedor/c659be779caceae663a0 to your computer and use it in GitHub Desktop.
Bloquear con javascript caracteres especiales
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//sin permiitr espacios | |
var r={'special':/[\W]/g} | |
//con espacios | |
var s={'special':/[^\w^ñ^(á|é|í|ó|ú)^\s^]/g} | |
function valid(o,w){ | |
o.value = o.value.replace(r[w],''); | |
} | |
function validaremos(o,w){ | |
o.value = o.value.replace(s[w],''); | |
} | |
//agregamos al input | |
onkeyup="validaremos(this,'special')" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment