From d280cf83e01d2da76b77c0a74d36e69df87cc024 Mon Sep 17 00:00:00 2001 From: kkrzowski Date: Thu, 20 Nov 2025 13:12:32 +0100 Subject: [PATCH] Update index.js --- index.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 6225aae..75dd477 100644 --- a/index.js +++ b/index.js @@ -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);