Found the answer here: https://stackoverflow.com/a/18853513/983173 Also, see update below.
Weird behavior I've been wrestling with all day. I would very much like to be able to provide mobile users of my website with the numeric keypad when they use my site, as a shortcut for them. I've been approaching this by setting my HTML input type to 'number' as seen here:
<input id='blah' class='blah' type='number' placeholder='blah'>
This worked, but I still want the site to look decent for PC users so I had to find help removing the spinner buttons that PC browsers add when you change an HTML input type to 'number' so I added this in CSS:
input[type='number'] {
-moz-appearance:textfield;
}
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
-webkit-appearance: none;
}
This also worked, so now I had HTML text inputs of type number, so that mobile users would automatically get the numeric keypad and PC users would not see ugly spinners. However at this point, I cannot type decimal '.' characters into my text fields in PC browsers. It works on mobile but not on PC. When I strike the '.' key, I actually visibly see the decimal appear in the text area, then disappear, but using an event listener on the input element, listening for a 'keyup' event, the value of the text input never reflects the '.' character being entered at all.
What have I missed?
Update: after copying these HTML and CSS elements into isolation (zer00ne thank you), I've traced the problem to my JavaScript, and past there to the implementation of the number input type's .value
member in particular. My JavaScript is pulling the value of the number input, doing some string work with it, then putting it back. For some reason, I can't detect the trailing decimal character '.' in the screen-visible text of the input field, so when I pull the value of the number input it drops the decimal every time I type on before putting it back. Is there any other way to detect a trailing decimal in a number input or get the raw value out so that i can see it?