feat(master-rule): make func input number

This commit is contained in:
arieeefajar 2025-01-31 14:34:31 +07:00
parent 40746fdeec
commit 6d608946f2
1 changed files with 21 additions and 0 deletions

View File

@ -1,3 +1,24 @@
document.addEventListener("DOMContentLoaded", function () {
const inputs = document.querySelectorAll(
"#rangemin-field, #rangemax-field",
"#mb-field",
"#md-field"
);
inputs.forEach((input) => {
input.addEventListener("input", function () {
this.value = this.value.replace(/[^0-9.]/g, "");
this.value = this.value.replace(/^(\.)/, "");
if ((this.value.match(/\./g) || []).length > 1) {
this.value = this.value.substring(
0,
this.value.lastIndexOf(".")
);
}
});
});
});
function updateData(rule) { function updateData(rule) {
console.log(rule); console.log(rule);
var form = document.getElementById("edit-form"); var form = document.getElementById("edit-form");