The price value dont appears with "$"
I have this code so when the user introduces for example "10" it appears 10,00 in the price field:
- document.getElementById("show_price").onblur = function () {
- var $price = document.getElementById("registration_type_price");
- $price.value = this.value;
- this.value = parseFloat(this.value.replace(/,|\$/g, ""))
- .toFixed(2)
- .toString()
- .replace(/\B(?=(\d{3})+(?!\d))/g, ".");
- }
But I would like to show also the $, like 10,00$. Do you know how to achieve that?
The input is like this:
- <div class="form-group col-md-6">
- <label for="registration_type_price">Price</label>
- <input type="hidden" name="registration_type_price" id="registration_type_price"/>
- <input type="number"
- onkeydown="javascript: return event.keyCode == 69 ? false : true"
- min="0" step="any"
- class="form-control"
- value="{{ old('registration_type_price', '0.00') }}"
- name="show_price" id="show_price" placeholder="Price (Ex: 15,00)"/>
- </div>