fix bug comma
This commit is contained in:
@@ -173,6 +173,9 @@
|
||||
<script src="~/BackendScript/js/bootstrap-datepicker-th/bootstrap-datepicker.th.js"></script>
|
||||
<script src="~/BackendScript/assets/bootstrap-daterangepicker/moment.min.js"></script>
|
||||
|
||||
<script src="https://hrm.stin.ac.th/plugins/jQuery-Mask-Plugin-master/dist/jquery.mask.min.js"></script>
|
||||
<script src="https://hrm.stin.ac.th/plugins/jquery-maskmoney-master/dist/jquery.maskMoney.min.js"></script>
|
||||
|
||||
<!--Select2-->
|
||||
<script src='~/select2/js/select2.min.js' type='text/javascript'></script>
|
||||
|
||||
@@ -209,6 +212,53 @@
|
||||
$( document ).on( 'focus', ':input', function(){
|
||||
$( this ).attr( 'autocomplete', 'off' );
|
||||
});
|
||||
|
||||
$(document).on('change', 'input.money', function() {
|
||||
var value = parseFloat(parseFloat($(this).val()).toFixed(2));
|
||||
$(this).maskMoney();
|
||||
$(this).unbind("focus.maskMoney");
|
||||
$(this).unbind("blur.maskMoney");
|
||||
$(this).maskMoney('mask', value);
|
||||
});
|
||||
|
||||
$(document).on('focus', 'input.money:not([readonly], :disabled)', function() {
|
||||
$(this).maskMoney('destroy');
|
||||
var val = $(this).maskMoney('unmasked')[0];
|
||||
val = val === 0 ? '' : val;
|
||||
$(this).val(val);
|
||||
});
|
||||
|
||||
$(document).on('blur', 'input.money', function() {
|
||||
preventDefault(event);
|
||||
var value = $(this).val();
|
||||
if (typeof value === 'string' && !value.includes(',')) {
|
||||
$(this).val($(this).val());
|
||||
$(this).change();
|
||||
}
|
||||
});
|
||||
|
||||
$('input.money').keypress(function(e){
|
||||
e = e || window.event;
|
||||
var key = e.which || e.charCode || e.keyCode,
|
||||
keyPressedChar = "",
|
||||
selection,
|
||||
startPos,
|
||||
endPos,
|
||||
value;
|
||||
|
||||
if ((key >= 48 && key <= 57) || e.key == '.') {
|
||||
} else {
|
||||
preventDefault(e);
|
||||
}
|
||||
});
|
||||
|
||||
function preventDefault(e) {
|
||||
if (e.preventDefault) { //standard browsers
|
||||
e.preventDefault();
|
||||
} else { // old internet explorer
|
||||
e.returnValue = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
@@ -151,6 +151,10 @@
|
||||
<script src="~/BackendScript/js/jquery.nicescroll.js" type="text/javascript"></script>
|
||||
<script src="~/BackendScript/js/jquery.sparkline.js" type="text/javascript"></script>
|
||||
<script src="~/BackendScript/js/respond.min.js"></script>
|
||||
|
||||
<script src="~/BackendScript/js/jQuery-Mask-Plugin-master/dist/jquery.mask.min.js"></script>
|
||||
<script src="~/BackendScript/js/jquery-maskmoney-master/dist/jquery.maskMoney.min.js"></script>
|
||||
<script src="~/BackendScript/js/jsrsasign-all-min.js"></script>
|
||||
|
||||
<script src="~/DataTables-1.10.16/js/jquery.dataTables.js" type="text/javascript"></script>
|
||||
<script src="~/DataTables-1.10.16/js/dataTables.bootstrap4.min.js" type="text/javascript"></script>
|
||||
@@ -168,6 +172,7 @@
|
||||
<script src="~/BackendScript/js/bootstrap-datepicker-th/bootstrap-datepicker.th.js"></script>
|
||||
<script src="~/BackendScript/assets/bootstrap-daterangepicker/moment.min.js"></script>
|
||||
|
||||
|
||||
<!--Select2-->
|
||||
<script src='~/select2/js/select2.min.js' type='text/javascript'></script>
|
||||
|
||||
@@ -184,20 +189,64 @@
|
||||
<iframe id="myframe" class="iframe-con" src=""></iframe>
|
||||
|
||||
<script>
|
||||
$('.allfontsize').click(function () {
|
||||
var fontsize = $(this).data('fontsize');
|
||||
$('body').attr('data-fontsize', fontsize);
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
$("#username").text(getCookie("emp_name"));
|
||||
</script>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$('.allfontsize').click(function () {
|
||||
var fontsize = $(this).data('fontsize');
|
||||
$('body').attr('data-fontsize', fontsize);
|
||||
});
|
||||
$("#username").text(getCookie("emp_name"));
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
$( document ).on( 'focus', ':input', function(){
|
||||
$( this ).attr( 'autocomplete', 'off' );
|
||||
});
|
||||
});
|
||||
|
||||
$('.money').maskMoney();
|
||||
|
||||
$(document).on('change', 'input.money', function() {
|
||||
var value = parseFloat(parseFloat($(this).val()).toFixed(2));
|
||||
$(this).maskMoney();
|
||||
$(this).unbind("focus.maskMoney");
|
||||
$(this).unbind("blur.maskMoney");
|
||||
$(this).maskMoney('mask', value);
|
||||
});
|
||||
$(document).on('focus', 'input.money:not([readonly], :disabled)', function() {
|
||||
$(this).maskMoney('destroy');
|
||||
var val = $(this).maskMoney('unmasked')[0];
|
||||
val = val === 0 ? '' : val;
|
||||
$(this).val(val);
|
||||
});
|
||||
$(document).on('blur', 'input.money', function() {
|
||||
preventDefault(event);
|
||||
var value = $(this).val();
|
||||
if (typeof value === 'string' && !value.includes(',')) {
|
||||
$(this).val($(this).val());
|
||||
$(this).change();
|
||||
}
|
||||
});
|
||||
$('input.money').keypress(function(e){
|
||||
e = e || window.event;
|
||||
var key = e.which || e.charCode || e.keyCode,
|
||||
keyPressedChar = "",
|
||||
selection,
|
||||
startPos,
|
||||
endPos,
|
||||
value;
|
||||
|
||||
if ((key >= 48 && key <= 57) || e.key == '.') {
|
||||
} else {
|
||||
preventDefault(e);
|
||||
}
|
||||
});
|
||||
|
||||
function preventDefault(e) {
|
||||
if (e.preventDefault) { //standard browsers
|
||||
e.preventDefault();
|
||||
} else { // old internet explorer
|
||||
e.returnValue = false;
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user