1

I am trying to create an input box that allow users to enter currency amount. I have created a text box in contact form 7, but it should automatically add "USD" at the end, as soon as someone enters the digit into the input box.

If it's not possible, USD written at the end of the input field would be fine too.

user6176114
  • 321
  • 2
  • 10

1 Answers1

2

As it is a required field, you can achieve this by adding a tag containing the "USD" text immediately after the input and set its display to none while the input is empty using the :invalid pseudo-class:

#input:invalid+span{
  display:none;
}
<input id="input" required type="number" value=""><span>USD</span>
Shaggy
  • 6,696
  • 2
  • 25
  • 45