$(document).ready(function()
{
$("#slider").slider(
{
animate: true,
value:1,
min: 1,
max: 10,
step: 1,
slide: function(event, ui)
{
update(1,ui.value); //changed
}
});
update();
});
//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>');
}