Topic: Currency Format in Input Form

BeldenSpartan free asked 3 years ago


I have input form with type="number". When the user enters the number, I'd like it formatted to a currency (specifically, US dollars). How can I do this?

<div class="form-outline">
    <input type="number" id="typeNumber" class="form-control" value={{ StartPrice }} />
    <label class="form-label" for="typeNumber">Set Target Price</label>
</div>

Additionally, is there a way to change the background color of the input field? Thank you -


Dawid Wajszczuk staff answered 3 years ago


Hi,

I'm not sure if you wanted this kind of formatting, but you can use something like this https://mdbootstrap.com/snippets/standard/d-wajszczuk/3241878#js-tab-view. It can be only achieved with text input.

As for changing the background you can do it with simple bg-* class, for example bg-primary. Here is the snippet showing more customization of the input field https://mdbootstrap.com/snippets/standard/d-wajszczuk/3241952#css-tab-view.

Keep coding,
Dawid



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB Standard
  • MDB Version: MDB5 3.9.0
  • Device: PC
  • Browser: Chrome
  • OS: Windows
  • Provided sample code: No
  • Provided link: No