Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
I would like to keep the input type as "number". So how to I get around this, if input type="number" only allows for numbers as value and not text.
This is what I'm trying to achieve:
<input type="number" name="amount" value="Other Amount">
Instead value I would use placeholder
<input type="number" name="amount" placeholder="Other Amount">
Add a comment
if you want to achieve text input which just numbers allowed, you should do something like this:
<input type="text" onkeypress='return event.charCode >= 48 && event.charCode <= 57'>
you need to control which character is allowed to be pressed down
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.