Hi i want to replace a comma with a dot while typing in a text input field using jQuery. I have this code right now;
$(document).on('change', '.unitprice', function() {
$(this).val().replace(/,/g, '.');
});
The class of the input field is unitprice
But it's not working.. And i can't seem to find the correct answer on google. Anybody has an idea on how to accomplish this?
You're just changing the variable and not writing it back.
$(this).val($(this).val().replace(/,/g, '.'));
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments