How to remove the two buttons of Input type="number" in HTML5? Example:
<p>Quero que isso:</p>
<input type="number">
<p>Vire isso porém sem usar o text, pois preciso do comportamento do number:</p>
<input type="text">
How to remove the two buttons of Input type="number" in HTML5? Example:
<p>Quero que isso:</p>
<input type="number">
<p>Vire isso porém sem usar o text, pois preciso do comportamento do number:</p>
<input type="text">
Locking by css.
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
/* display: none; <- Crashes Chrome on hover */
-webkit-appearance: none;
margin: 0; /* <-- Apparently some margin are still there even though it's hidden */
}
input[type=number] {
-moz-appearance:textfield;
}
<input type="number" onkeypress='return event.charCode >= 48 && event.charCode <= 57'></input>
Or you could do a text and validate by just accepting numbers. As below:
<input type="text" onkeypress='return event.charCode >= 48 && event.charCode <= 57'>
</input>