$(document).ready(function() {
$("#slider").slider({
animate: true,
value:500,
min: 0,
max: 1000,
step: 10,
slide: function(event, ui) {
update(1,ui.value); //changed
}
});
update(1, 500);
});
//changed. now with parameter
function update(slider,val) {
//changed. Now, directly take value from ui.value. if not set (initial, will use current value.)
var $amount = slider == 1?val:$("#amount").val();
$('#slider a').html('<label><span class="glyphicon glyphicon-chevron-left"></span> '+$amount+' <span class="glyphicon glyphicon-chevron-right"></span></label>');
}