Toggle navigation
Bootsnipp
Bootstrap
For
CSS Frameworks
Bootstrap
Foundation
Semantic UI
Materialize
Pure
Bulma
References
CSS Reference
Tools
Community
Page Builder
Form Builder
Button Builder
Icon Search
Dan's Tools
Diff / Merge
Color Picker
Keyword Tool
Web Fonts
.htaccess Generator
Favicon Generator
Site Speed Test
Snippets
Featured
Tags
By Bootstrap Version
4.1.1
4.0.0
3.3.0
3.2.0
3.1.0
3.0.3
3.0.1
3.0.0
2.3.2
Register
Login
"Increment and decrement the text box value"
Bootstrap 3.0.0 Snippet by
sachinkul6185@gmail.com
3.0.0
jQuery
Preview
HTML
CSS
JS
View Full Screen
Fork
Fork this
3.7K
 
1 Fav
Post to Facebook
Tweet this
<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); } }); });
Questions / Comments:
Post
Posting Guidelines
Formatting
- Now
×
Close
Donate
BTC: 12JxYMYi6Vt3mx3hcmP3B2oyFiCSF3FhYT
ETH: 0xCD715b2E3549c54A40e6ecAaFeB82138148a6c76