feat(master-rule): make func input number
This commit is contained in:
parent
40746fdeec
commit
6d608946f2
|
@ -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");
|
||||||
|
|
Loading…
Reference in New Issue