No...">

How to replace character with input value using jQuery?

I created inputs with price values.

Example:

<input type="text" value="59,00"/> 

Now I have to replace , (comma) with . (dot) using jQuery.

I tried this, but it does not work:

 $('#inputid[value~=,]').each(function(i){ $(this).text($(this).text().replace(',','.')) }); 

Could you help me?

+4
source share
1 answer
 $('input:text').each(function() { var value = $(this).val(); $(this).val(value.replace(/\,/i, '.')); }); 
+4
source

Source: https://habr.com/ru/post/1303271/


All Articles