jQuery Number (edit)
HTML
<input type="text" class="form-control positive-integer" id="soGoldNhanCuoc" readonly value="15000000" name="soGoldNhanCuoc" required>
Numeric (jquery.numeric.min.js)
https://github.com/SamWM/jQuery-Plugins/tree/master/numeric
$(".positive-integer").numeric({ decimal: false, negative: false }, function () { alert("Positive integers only"); this.value = ""; this.focus(); });
AutoNumeric (autoNumeric.min.js)
https://github.com/autoNumeric/autoNumeric
autoNumeric 1.8.3
https://cdnjs.cloudflare.com/ajax/libs/autonumeric/1.8.3/autoNumeric.js
https://cdnjs.cloudflare.com/ajax/libs/autonumeric/1.8.3/autoNumeric.min.js
autoNumeric 1.9.41
https://cdnjs.cloudflare.com/ajax/libs/autonumeric/1.9.41/autoNumeric.js
https://cdnjs.cloudflare.com/ajax/libs/autonumeric/1.9.41/autoNumeric.min.js
autoNumeric-2.0.13
https://github.com/autoNumeric/autoNumeric/releases/tag/v2.0.13
autoNumeric 4.x
https://cdnjs.cloudflare.com/ajax/libs/autonumeric/4.1.0/autoNumeric.js
https://cdnjs.cloudflare.com/ajax/libs/autonumeric/4.1.0/autoNumeric.min.js
Lấy số từ người dùng nhập vào .autoNumeric('getSettings').rawValue
https://github.com/autoNumeric/autoNumeric/issues/251
https://github.com/autoNumeric/autoNumeric/issues/399
var soGoldCuoc = $('#soGoldDatCuoc').autoNumeric('get');
Không hiển thị dấu thập phân
https://github.com/autoNumeric/autoNumeric/issues/35
$('.positive-integer').autoNumeric('init', { mDec: '0' }, { formatOnPageLoad: true });
JavaScript format number
function formatGold(gold) {
return gold.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,");
}