Dynamic slider value not working (ui.value)
I'm trying to print the value of some dynamic sliders, but the value it didn't add to the inputs:
$(document).ready(function () {
var N = 10;
var initVal = 1;
for (var id = 1; id <= N; id++) {
var $newResult = $('<input/>', {
type: 'text',
id: 'result-' + id,
class: 'sliderText',
value: initVal
});
var $newSlider = $("<div/>", {
id: 'slider-' + id,
class: 'ui-slider'
}).slider({
range: 'min',
min: initVal,
max: N,
value: initVal,
step: 1,
slide: function(event, ui) {
$newResult.val(ui.value); // neither works $( '#result-' + id )
}
});
var $container = $("<div/>", {
id: 'sliderContainer-' + id
}).append($newResult).append($newSlider);
$("#showSldr").append($container);
}
});
I don't seem to see something, maybe someone does: P
+3
source to share