A Pen by eugenio chaparro on CodePen.
Created
July 8, 2019 22:50
-
-
Save ldavidsp/764d46db05dc2fc8bd4ebdb27cf6664e to your computer and use it in GitHub Desktop.
VALIDAR SOLO NUMEROS
This file contains hidden or 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
<!--SOLO NUMEROS--> | |
<h1>SOLO NUMEROS</h1> | |
<input type="text" class="validar"/> |
This file contains hidden or 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
//SOLO NUMEROS | |
$(function(){ | |
$(".validar").keydown(function(event){ | |
//alert(event.keyCode); | |
if((event.keyCode < 48 || event.keyCode > 57) && (event.keyCode < 96 || event.keyCode > 105) && event.keyCode !==190 && event.keyCode !==110 && event.keyCode !==8 && event.keyCode !==9 ){ | |
return false; | |
} | |
}); | |
}); |
This file contains hidden or 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
<script src="//code.jquery.com/jquery-1.10.2.js"></script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment