Update index.js
This commit is contained in:
16
index.js
16
index.js
@@ -1,6 +1,6 @@
|
|||||||
class IdmQuantityPicker{
|
class IdmQuantityPicker{
|
||||||
constructor({selector , min = 1, max = 99}) {
|
constructor({selector , min, max, ref}) {
|
||||||
const container = document.querySelector(selector);
|
const container = selector ? document.querySelector(selector) : ref;
|
||||||
if(!container){
|
if(!container){
|
||||||
console.error("IdmQuantityPicker: container not found.");
|
console.error("IdmQuantityPicker: container not found.");
|
||||||
return;
|
return;
|
||||||
@@ -13,6 +13,18 @@ class IdmQuantityPicker{
|
|||||||
}
|
}
|
||||||
this.input = input;
|
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.min = min;
|
||||||
this.max = max;
|
this.max = max;
|
||||||
this._value = Number.parseInt(input.value);
|
this._value = Number.parseInt(input.value);
|
||||||
|
|||||||
Reference in New Issue
Block a user