i am trying to create an input field where the user can only type in numbers. this function is already working almost fine for me:
$(\'#p_first\').k
Try this solution:
jQuery('.numbersOnly').keyup(function () {
this.value = this.value.replace(/[^0-9\.]/g,'');
});
Demo: http://jsfiddle.net/DbRTj/
Same questions: