jQuery ui, slider how to get value from $(this)
Im using jQuery ui's slider, and my question now is kinda simple, i want to know how i can get value from $(this).find(".progress-bar").data("valuenow");
This is my code:
- $( ".slider-vertical" ).slider({
orientation: "horizontal",
animate: 'fast',
range: "min",
min: 0,
max: 100,
value: 60,
slide: function( event, ui ) {
var test = $(this).find(".progress-bar");
$(test).css("width", ui.value + '%');
}
});
The slide works with the width, but i need to have $(this).find(".progress-bar").data("valuenow"); to the value, tried to but in that code at value aswell but didn't work, anyone else got any idea?
EDIT: I solved this by using the create event like this:
- $( ".slider-vertical" ).slider({
orientation: "horizontal",
animate: 'fast',
range: "min",
min: 0,
max: 100,
value: 60,
create: function( event, ui ) {
var slider = $(this).find(".progress-bar").data("valuenow");
$(this).slider("value", slider);
},
slide: function( event, ui ) {
var test = $(this).find(".progress-bar");
$(test).css("width", ui.value + '%');
}
});