Hey I'm trying to create an input field in javascript that has the rail back end,
$ 100.24
How can I pull it out? Currently a person can put more in several decimal points is. Hope this question is not very unclear.
Bind this function to an annotation event in your text field. It will parse the value of the field as a float and remove any number after 2 decimals. You can also use Needless to say, it requires server-side verification, the user can easily disable JavaScript and input type: if this data comes back to your server, then expect it to work. Will never be. working jsfiddle :. Input: 123456 - Result: 123.456 Input: 12,3456 - Result: 12,34 input type = "number" to prevent the string as an input.
function check (e) {e.value = parseFloat (e. Value) .toFixed (2)}
No comments:
Post a Comment