I'm trying to save number with thousands separator inside number field
1000 >> 1,000
100000 >> 10,000
2000.02 >> 2,000.02
i want to use js and jquery for this issue, i want thousands separators become visible when the user is typing.
<div class="form-group">
<label class="control-label col-md-2" Sum</label>
<div class="col-md-10">
@Html.EditorFor(model => model.Sum, new { htmlAttributes = new { @class = "form-control", @type = "number" } })
@Html.ValidationMessageFor(model => model.Sum, "", new { @class = "text-danger" })
</div>
</div>
Any help?
You can try autoNumeric plugin. Basic init will do what you need:
$('#Sum').autoNumeric('init');
Check section:
The basics on getting
autoNumeric()
up and running with the initialize 'init' method and default settings: ...