Topic: Range Slider Thumb Value
Ericka Anne asked 8 years ago
jkilbride answered 8 years ago
<div class="range-field">
<input type="range" min="0" max="100" value="10" id="my-range">
<label for="my-range">Initial value (10)</label>
</div>
<script>
$('#my-range').on('change input', function() {
var $this = $(this);
$this.siblings('label').html('Current value (' + $this.val() + ')');
});
</script>
Hope this helps! Rafał Rogulski answered 8 years ago
.thumb {
border-radius: 50% 50% 50% 0 !important;
height: 30px !important;
width: 30px !important;
margin-left: -15px !important;
top: -20px !important;
left: 50%;
}
input[type=range] + .thumb .value {
color: #fff;
margin-left: -1px;
margin-top: 8px;
font-size: 10px;
}
and JS :
$(document).ready(function() {
$('.range-field').each(function() {
$(this).find('.value').html('50');
});
});
This work with default range from MDB documentation. When you have set 'value' attribute you must change the value in .html('your value');
and .thumb
in left: your value;
, also this script set this value for all range input.
Regards
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
- User: Free
- Premium support: No
- Technology: General Bootstrap questions
- MDB Version: -
- Device: -
- Browser: -
- OS: -
- Provided sample code: No
- Provided link: No