Replaced uses of "valueAsNumber" function as it is not supported in some browsers.