I have two clickable spans that can increase and decrease number inside a input by saving the opreation inside them using an id then loop on them and do the opreation using eval() , i want to increase the number and decrease it while pressing not only on click (Long Press)
<span id="--">-</span>
<input class="num" type="number" max="50" value="0" min="1" disabled />
<span id="++">+</span>
let num = document.querySelector(".num");
let controllers = document.querySelectorAll(".control span");
controllers.forEach((c) => {
c.onclick = function (e) {
let op = e.target.id;
eval("num.value" + op);
};
});