Decimals point type for the input type number of HTML5

2

I have the following input:

<input type="number" value="1.5" step="1" id="id_texto" />

Currently the value of the input shows me 1.5. But what I want is to show me 1.5. I want decimals to show it to me with a period, and not with a comma.

Maybe with Jquery or some definition of lang = en. I've looked for ways to solve it, but it has not worked.

    
asked by Danilo 10.06.2017 в 00:24
source

2 answers

1

Your problem is internalization with the language better known as i18n , by default browsers select the detected language (by internet and location)

Your solution is to add a library, but there are many libraries and they change with respect to the user version of Jquery among others, you should generally add the library .js and select the language of your preference this will also influence the dates

a small example using the repository link you can do this: in the header add the line

<input type="script" src="jquery.i18n/src/jquery.i18n.language.js"</script>

and within the page this line

$.i18n( {
    locale: 'en' // Ingles puedes elejir el idioma que necesittes
} );**
    
answered by 10.06.2017 в 00:35
0

You can use JavaScript to edit the value with

input.value = input.value.replace(',', '.')
    
answered by 10.06.2017 в 19:13