Return to Snippet

Revision: 56104
at March 10, 2012 00:48 by itsmeameer


Initial Code
jQuery.fn.forceNumeric = function() {
	$(this).keydown(function(event){
		if( event.keyCode == 46 || event.keyCode == 8 || (event.keyCode < 41 && event.keyCode > 36) || (event.keyCode < 58 && event.keyCode > 47) || (event.keyCode < 106 && event.keyCode > 94) ){
		}else{
			event.preventDefault();
		}
	});
}

Initial URL

                                

Initial Description
Use:
<script>
$(document).ready(function(){ 
$("#input").forceNumeric();
});
</script>

Initial Title
Only Numaric Input for Javascript (jQuery)

Initial Tags
jquery

Initial Language
jQuery