/ Published in: jQuery
                    
                                        
N'autorise que les chiffres (avec , ou . ou négatifs) dans un input
                
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
$("#inputTarif").keypress(function(event){
var charCode = (event.which) ? event.which : window.event.keyCode;
if (charCode <= 13) { return true;}
else {
var keyChar = String.fromCharCode(charCode);
var Exp = new RegExp("[0-9,.-]");
return Exp.test(keyChar);
}
});
Comments
 Subscribe to comments
                    Subscribe to comments
                
                