http://jsfiddle.net/ecDmn/1/ $("#txtQty").keyup(function() { var $this = $(this); $this.val($this.val().replace(/[^\d.]/g, '')); });