Prohibir ciertos caracteres en un input


/ Published in: JavaScript
Save to your folder(s)

No permite ingresar la ñ o Ñ


Copy this code and paste it in your HTML
  1. <html>
  2. <head>
  3. <script>
  4. //No permite ingresar la ñ o Ñ
  5. function coma(e) {
  6. tecla=(document.all) ? e.keyCode : e.which;
  7. //alert(tecla);
  8. if (tecla==241 || tecla==209) {
  9.  
  10. return false;
  11. }
  12. }
  13. </script>
  14. </head>
  15.  
  16. <body bgcolor="#FFFFFF" text="#000000">
  17. <input type="text" onKeyPress="return coma(event)">
  18. </body>
  19. </html>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.