Update index.js

This commit is contained in:
2025-11-20 13:12:32 +01:00
parent 47c350f29b
commit d280cf83e0

View File

@@ -1,6 +1,6 @@
class IdmQuantityPicker{
constructor({selector , min = 1, max = 99}) {
const container = document.querySelector(selector);
constructor({selector , min, max, ref}) {
const container = selector ? document.querySelector(selector) : ref;
if(!container){
console.error("IdmQuantityPicker: container not found.");
return;
@@ -13,6 +13,18 @@ class IdmQuantityPicker{
}
this.input = input;
if(typeof min === "undefined"){
min = this.input.min;
}else{
this.input.min=min;
}
if(typeof min === "undefined"){
max = this.input.max;
}else{
this.input.max=max;
}
this.min = min;
this.max = max;
this._value = Number.parseInt(input.value);