Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

html input type = number doesn't allow decimal points on certain droids

Tags:

html

android

When an input is type = number, smart phones and tablets will automatically open the number keyboard when you click on the input field. However on the Samsung droid which I'm developing a website for, the number pad doesn't allow for decimals to be entered (the telephone dial pad opens). I'd like a number keyboard to appear that allows decimals. Any ideas?

The alphanumeric keyboard for the tablet has the numbers on the top (not a separate number section), which is making me lose hope that what I want is possible, but maybe y'all have some bright ideas.

like image 680
Pepperfudge Avatar asked Jun 26 '14 22:06

Pepperfudge


People also ask

How do I restrict decimal places in HTML?

To limit decimal places in JavaScript, use the toFixed() method by specifying the number of decimal places.

Can input type number accept decimal?

You can also use a decimal value: for example, a step of 0.3 will allow values such as 0.3, 0.6, 0.9 etc, but not 1 or 2. Now you don't get a validation error.

How do you set restrictions on what numbers are accepted in input type?

Complete HTML/CSS Course 2022 To limit an HTML input box to accept numeric input, use the <input type="number">. With this, you will get a numeric input field. After limiting the input box to number, if a user enters text and press submit button, then the following can be seen “Please enter a number.”


1 Answers

From my understanding, all that the <input type = number> is doing is calling on the keyboard to launch. What keyboard launches (stock, downloaded, emoji) and what subtype (number pad, QWERTY) is dependent on the keyboard app itself. Basically the stock keyboard is bringing up the numeric keypad but that keypad doesn't have a decimal which you want. If the end-user has another keyboard downloaded then that keyboard may have a different layout that includes a decimal on the numeric keypad. I know the keypad is your preferred choice but have you thought about just changing your code to calling on the QWERTY keyboard that has both numbers and the needed decimal? If a decimal is critical to what you want to accomplish I think that would be the best option.

like image 165
racecarjonathan Avatar answered Oct 05 '22 01:10

racecarjonathan