I've been using the new attributes maxlength option to limit the number of characters that can be inputted to a text object, and it works well.
I'd also like to limit it to only accepting numbers and backspace.
I've tried using the code at https://www.dofactory.com/html/input-at ... idyouknow2 by adding the following to the onkeydown event (both with and without the original double quotes and also encasing it within a function)
Code: Select all
return (event.charCode != 8 && event.charCode == 0 || (event.charCode >= 48 && event.charCode <= 57))
Can anyone suggest a way to get it to work?
Thanks,
Paul