"Number Input Buttons with No Min/Max"
Bootstrap 3.0.0 Snippet by ImGuss

<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <!------ Include the above in your HEAD tag ----------> <div class="row"> <div class="col-sm-3"></div> <div class="col-sm-2"> <label>First</label> <!-- purely semantic --> <div class="form-control input-sm center merge-bottom-input" name="first">0</div> <div class="btn-group btn-block" role="group" aria-label="plus-minus"> <button type="button" class="btn btn-sm btn-danger minus-button merge-top-left-button"><span class="glyphicon glyphicon-minus"></span></button> <button type="button" class="btn btn-sm btn-success plus-button merge-top-right-button"><span class="glyphicon glyphicon-plus"></span></button> </div><!-- end button group --> </div> <!-- end column --> <div class="col-sm-2"> <label>Second</label> <div class="form-control input-sm center merge-bottom-input"name="second">0</div> <div class="btn-group btn-block" role="group" aria-label="plus-minus"> <button type="button" class="btn btn-sm btn-danger minus-button merge-top-left-button"><span class="glyphicon glyphicon-minus"></span></button> <button type="button" class="btn btn-sm btn-success plus-button merge-top-right-button"><span class="glyphicon glyphicon-plus"></span></button> </div><!-- end button group --> </div> <!-- end column --> <div class="col-sm-2"> <label>Third</label> <div class="form-control input-sm center merge-bottom-input" name="third">0</div> <div class="btn-group btn-block" role="group" aria-label="plus-minus"> <button type="button" class="btn btn-sm btn-danger minus-button merge-top-left-button"><span class="glyphicon glyphicon-minus"></span></button> <button type="button" class="btn btn-sm btn-success plus-button merge-top-right-button"><span class="glyphicon glyphicon-plus"></span></button> </div><!-- end button group --> </div> <!-- end column --> <div class="col-sm-3"></div> </div><!-- end row -->
.center { text-align: center; } .merge-bottom-input { width: 67px; border-bottom-left-radius: 0; border-bottom-right-radius: 0; } .merge-top-left-button { border-top-left-radius: 0; } .merge-top-right-button { border-top-right-radius: 0; }
$(document).ready( () => { $('.minus-button').click( (e) => { const currentInput = $(e.currentTarget).parent().prev()[0]; let minusInputValue = $(currentInput).html(); minusInputValue --; $(currentInput).html(minusInputValue); }); $('.plus-button').click( (e) => { const currentInput = $(e.currentTarget).parent().prev()[0]; let plusInputValue = $(currentInput).html(); plusInputValue ++; $(currentInput).html(plusInputValue); }); });

Related: See More


Questions / Comments: