Replace comma with a dot while typing jQuery

luissimo

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?

Lazar Ljubenović

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.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Replace ,(comma) by .(dot) and .(dot) by ,(comma)

From Dev

Replace a dot with a comma inside a jQuery template

From Dev

Replace a dot with a comma inside a jQuery template

From Dev

Replace dot character once entered by a comma in jquery

From Dev

Best way to replace comma with a dot jquery

From Dev

Replace dot with comma on SELECT

From Dev

Need to replace "comma" with 'dot'

From Dev

how to replace comma with dot

From Dev

Replace comma with dot in a input Javascript

From Dev

replace comma to dot in perl array

From Dev

javascript replace comma with dot / paypal

From Dev

Replace comma with dot in a input Javascript

From Dev

match float with comma and then replace comma with dot?

From Dev

Find and replace while typing command

From Dev

Find and replace while typing command

From Dev

Adding comma while typing in the text box

From Dev

replace comma with dot in scientific notation in r

From Dev

In Java, convert the dot to comma in DecimalFormat replace method

From Dev

How to replace number dot (.) with a comma (,) using java

From Dev

How to replace dot with comma in price format in php

From Dev

How can i replace dot with comma in iReport?

From Dev

Decimalformat: unwanted replace of dot with comma in JTable

From Dev

Replace comma with period jQuery

From Dev

Replace a part of text in textbox while typing text in it

From Dev

Replace the decimal dot with a comma on an axis in D3?

From Dev

Replacing comma by dot only in numbers in a texteditor using search and replace function

From Dev

JQUERY Autcomplete while typing with remote data

From Dev

jquery validator.methods.number and comma instead of dot in number

From Dev

How to use jquery function on numbers separated by .(dot) or ,(comma) as thousands separator

Related Related

  1. 1

    Replace ,(comma) by .(dot) and .(dot) by ,(comma)

  2. 2

    Replace a dot with a comma inside a jQuery template

  3. 3

    Replace a dot with a comma inside a jQuery template

  4. 4

    Replace dot character once entered by a comma in jquery

  5. 5

    Best way to replace comma with a dot jquery

  6. 6

    Replace dot with comma on SELECT

  7. 7

    Need to replace "comma" with 'dot'

  8. 8

    how to replace comma with dot

  9. 9

    Replace comma with dot in a input Javascript

  10. 10

    replace comma to dot in perl array

  11. 11

    javascript replace comma with dot / paypal

  12. 12

    Replace comma with dot in a input Javascript

  13. 13

    match float with comma and then replace comma with dot?

  14. 14

    Find and replace while typing command

  15. 15

    Find and replace while typing command

  16. 16

    Adding comma while typing in the text box

  17. 17

    replace comma with dot in scientific notation in r

  18. 18

    In Java, convert the dot to comma in DecimalFormat replace method

  19. 19

    How to replace number dot (.) with a comma (,) using java

  20. 20

    How to replace dot with comma in price format in php

  21. 21

    How can i replace dot with comma in iReport?

  22. 22

    Decimalformat: unwanted replace of dot with comma in JTable

  23. 23

    Replace comma with period jQuery

  24. 24

    Replace a part of text in textbox while typing text in it

  25. 25

    Replace the decimal dot with a comma on an axis in D3?

  26. 26

    Replacing comma by dot only in numbers in a texteditor using search and replace function

  27. 27

    JQUERY Autcomplete while typing with remote data

  28. 28

    jquery validator.methods.number and comma instead of dot in number

  29. 29

    How to use jquery function on numbers separated by .(dot) or ,(comma) as thousands separator

HotTag

Archive