Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change . (point) sparator to , (comma) on input type='number' in html5

Tags:

html

how to change . to , on input type='number' in html5, couse in my country for fraction use , not . . i'll process it into .php

like image 389
wawan Setiyawan Avatar asked Sep 01 '25 21:09

wawan Setiyawan


1 Answers

OPTION 1. use <input type="number" lang="en" value="13.5"> if you want . , and if you want , (comma) use lang="your-language" . and it will change automatically to a comma

BROWSER SUPPORT : this is not supported in every browser ( Chrome doesn't support it, Mozzila FF does. ) . so you might want to use another solution

see here more about this solution :lang input[type="number]

see snippet:

<input type="number" lang="en" value="13.5">
<input type="number" lang="ro" value="13.5">

OPTION 2

you could use the php function str_replace() see more here > str_replace()

or other similar SO questions > replace dot with comma1 and replace dot with comma2

like image 105
Mihai T Avatar answered Sep 03 '25 21:09

Mihai T