I have a page with some elements that are controlled by the user. One of these is a text input field, where the user is supposed to input a number. Everything works well if
Or even better, given the general unreliability of user input, use this to get rid of all non-numeric characters: var s = "9,Ljk876"; var t = parseInt(s.replace(/[^0-9]/g, '')); alert ("s:" + s + ", t:" + t);
var s = "9,Ljk876"; var t = parseInt(s.replace(/[^0-9]/g, '')); alert ("s:" + s + ", t:" + t);