JS 输入微调器是否存在?否 JQUERY

Is JS input spinners exists? NO JQUERY

我正在寻找下图所示的 js 微调器(左右控制键)。 但我不想在我的项目中使用 jquery。如果您有任何片段、有用的链接 - 请将其粘贴到此处。 :) 首选简单的短代码.. :) 也许它有另一个名字(不是微调器,而是..?)?

function addSpinner(parent){
var very = document.createElement("div"); // create a div
var minus = document.createElement("button"); // create minus button
var plus = document.createElement("button"); // create plus button
minus.innerHTML = "-"; // draw minus sign
plus.innerHTML = "+"; // draw plus sign
var input = document.createElement("input"); // create an input
input.type = "number"; // type number
input.value = "0"; // and default is 0
very.appendChild(minus); // append the minus sign to the div
very.appendChild(input); // append the input to the div
very.appendChild(plus); // append the plus sign to the div
minus.addEventListener("click", function() {input.value = +input.value - 1});
plus.addEventListener("click", function() {input.value = +input.value + 1});
// + before input.value is to change type from string to number so we can increase/decrease number by 1
parent.appendChild(very);
}

现在你称它为:addSpinner(document.body)