Hey the expression REGEX
var valid = /^\d{0,8}(\.\d{0,2})?$/.test(this.value),
Allows only numbers with a decimal following 2 digits only. And maximum allows 8 numbers. Which i have replaced now to allow a negative number as well without any digit limit after decimal as well. So kindly open file computer-repair-shop >> assets >> admin >> js >> my-admin.js
and replace all code with attached.
// JavaScript Document
(function($) {
"use strict";
//calling foundation js
jQuery(document).foundation();
jQuery.fn.exists = function(){ return this.length > 0; }
jQuery(document).on("keyup", "#wc_price, #wc_cost, .wc_validate_number", function(){
var valie = /^-?[0-9]\d*(\.\d+)?$/.test(this.value),
//var valid = /^\d{0,8}(\.\d{0,2})?$/.test(this.value),
val = this.value;
if(!valid){
console.log("Invalid input!");
this.value = val.substring(0, val.length - 1);
}
});
jQuery(document).ready(function() {
$('#customer, #technician, #select_rep_products, #select_rep_services, #job_technician, #job_customer').select2();
if($('#updateUserFormReveal').exists()) {
$('#updateUserFormReveal').foundation('open');
}
});
})(jQuery); //jQuery main function ends strict Mode on
After updating file don't forget to refresh your cache and you would be able to have negative numbers as well thanks.