View Single Post
Old 11-06-2011, 07:26 PM   PM User | #4
SB65
Senior Coder

 
Join Date: Feb 2009
Location: West Yorkshire
Posts: 2,817
Thanks: 9
Thanked 681 Times in 675 Posts
SB65 will become famous soon enoughSB65 will become famous soon enough
OK.

Maybe I'm missing something but why do you need to go via a string? Won't:

Code:
		$("input").live("keyup", function (e) {
		if (e.keyCode >= 48 && e.keyCode <= 57) {
				console.log(parseInt($(this).val()));
			};
		});
do what you need? So if the user types 123 into the input the code will produce 1, 12, 123 as the keys are pressed - is that what you want?

From a brief test in FF7 (only) I got better results with keyup compared to keypress, incidentally.
SB65 is offline   Reply With Quote
Users who have thanked SB65 for this post:
fishbaitfood (11-06-2011)