Poznakomlus,
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
</head>
<body>
<style>
.podbor {
position: relative;
}
.podbor>input {
padding: 2px 2px 1px 4px;
font-size: 30px;
width: 70px;
height: 40px;
float: left;
border: 1px solid #666;
border-radius: 4px 0 0 4px;
}
.podbor>span {
display: block;
font-size: 18px;
position: absolute;
left: 58px;
margin: 0;
padding: 2px;
line-height: 14px;
width: 14px;
border: 1px solid #666;
background-color: #E4E4E4;
text-align: center;
cursor: pointer;
}
.podbor>.plus {
border-bottom: none;
height: 18px;
}
.podbor>.minus {
top: 23px;
height: 16px;
}
.podbor>span:hover {
background-color: #999;
}
.clear {
clear: both;
}
</style>
<div class="clear"></div>
<div class="podbor" data-min="0" data-max="5">
<input type="text" value="1"/>
<span class="plus">+</span>
<span class="minus">-</span>
</div>
<div class="clear"></div>
<hr>
<div class="clear"></div>
<div class="podbor" data-min="3" data-max="8">
<input type="text" value="3" />
<span class="plus">+</span>
<span class="minus">-</span>
</div>
<script>
(_ => {
[...document.querySelectorAll('.podbor')].forEach(el => {
let inp = el.querySelector('input'), {min,max} = el.dataset;
el.onclick = ({target}) => {
if (target.tagName !== "SPAN") return;
target.closest(".minus") ? --inp.value : ++inp.value;
inp.value = Math.max(min, Math.min(+inp.value, max));
}});
})();
</script>
</body>
</html>