1

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">

2 Answers 2

4

Instead value I would use placeholder

<input type="number" name="amount" placeholder="Other Amount">
Sign up to request clarification or add additional context in comments.

Comments

0

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

Comments

Your Answer

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.

Ask question

Explore related questions

See similar questions with these tags.