I have an HTML input element and I'm trying to force a single decimal place into the input after the user changes the value. So, let's say the user enters "4", I run this code:
this.value = this.value.toFixed(1)
but then I get a JavaScript error saying "Object 4 has no method 'toFixed'".
It seems like JavaScript is trying to process a literal as a Number and failing but, er, why? And how do I avoid it?