"Increment and decrement the text box value"
Bootstrap 3.0.0 Snippet by sachinkul6185@gmail.com

<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="container"> <div class="row"> <div class="adult-range col-xs-2"> <span id="aminus" class="dec-value">-</span> <span><input type="text" id="adnum" class="leave-text-box text-center form-control" name="adult-count" value="0"/></span> <span id="aplus" class="inc-value" >+</span> </div> </div> </div> <div class="col-lg-6"> <div class="offer-circle"> <p>kal ho na ho</p> <h2>Hellow World</h2> <h3>$ 500</h3> <p>kal ho na ho</p> </div> </div>
.dec-value{cursor:pointer;background:#000;padding:0px 10px;color:#fff;font-size:25px;line-height:10px;} .inc-value{cursor:pointer;background:#000;padding:0px 10px;color:#fff;font-size:25px;line-height:10px;} .adult-range span{display:inline;} .offer-circle { width: 200px; height: 200px; padding: 25px 0; background: rgba(0, 0, 0, .8); color: #fff; text-align: center; border-radius: 100%; overflow: hidden; border: 2px solid #3322bf; } .offer-circle h2{ margin:10px 0 0 0; padding: 0; font-size: 25px;} .offer-circle h3{ margin: 0px 0 0 0; padding: 0; font-size: 25px;line-height:40px;} .offer-circle p{color:#fff; font-size: 15px;margin:5px 0;}
$(document).ready(function() { $('.inc-value').click(function(){ var x = $(this).parent().find('input[type="text"]').val(); x++; if(x > 10) { $(this).parent().find('input[type="text"]').attr('disabled', true); } else { $(this).parent().find('input[type="text"]').val(x); } }); $('.dec-value').click(function(){ $(this).parent().find('input[type="text"]').attr('disabled', false); var x = $(this).parent().find('input[type="text"]').val(); x--; if(x < 0) { $(this).parent().find('input[type="text"]').attr('disabled', true); } else { $(this).parent().find('input[type="text"]').val(x); } }); });

Related: See More


Questions / Comments: