there are two input'a, one of them duplicates the second, the numbers switch when you click on + and - but you also need the ability to write the value in the field yourself, this value should be limited, just from 1 to 30
jQuery(function($) { $(document).on('keydown', '#setinputone', function(e) { if (e.key.length == 1 && e.key.match(/[^0-9'".]/)) { return false; }; }) $(document).on('click', '.plus_and_minus', function() { var $input = $(this).parent().find('input'); var count = parseInt($input.val()); if ($(this).hasClass('minus')) { count = count <= 1 ? 30 : count - 1; $input.val(count); $('#setinputtwo').val(count); } else { count = count >= 30 ? 1 : count + 1; $input.val(count); $('#setinputtwo').val(count); } }); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <a href="#" class="minus plus_and_minus glyphicon glyphicon-minus coloriconmodal positionforlabel">-</a> <input type="text" class="imputssettingmodal" id="setinputone" value="1" size="3" /> <a href="#" class="plus plus_and_minus glyphicon glyphicon-plus coloriconmodal">+</a> <input type="text" class="imputssettingmodal positionforlabeltwo" id="setinputtwo" value="1" size="3" disabled/>