Get the Value from a Slider when the slider is moved (in Limesurvey)
i'm working with Limesurvey and Javascript for the first time. I want to
get the value of a slider everytime it is moved. I didn't know how to do
this properly. Until now it got something like:
$(document).ready(function() {
$( "#slider-handle-576875X1492X18245SQ001" ).click(function() {
alert($( ".ui-slider-handle ui-state-default ui-corner-all"
).slider( "value"));
});
});
And this works so far, that everytime i click the slider, i get a alert,
but it only gives me [objetc Object] and not the value.
I'm not sure how i can get the value, because if i look at the html code
of the slider, the value (at this moment 14) is stored anywhere, just in
percentage via style="left: 46.666666666666664%;">
I just post it here so you can have a look!
<div id="slider-576875X1492X18245SQ001" class="ui-slider-1 ui-slider
ui-slider-horizontal ui-widget ui-widget-content ui-corner-all">
<div id="slider-left-576875X1492X18245SQ001" class="slider_showmin">0</div>
<div class="slider_callout" id="slider-callout-576875X1492X18245SQ001"
style="left: 93.32386016845703px;">14</div>
<div class="ui-slider-handle ui-state-default ui-corner-all"
id="slider-handle-576875X1492X18245SQ001" style="left:
46.666666666666664%;"></div>
<div id="slider-right-576875X1492X18245SQ001"
class="slider_showmax">30</div>
</div>
<div id="slider-left-576875X1492X18245SQ001" class="slider_showmin">0</div>
<div class="slider_callout" id="slider-callout-576875X1492X18245SQ001"
style="left: 93.32386016845703px;">14</div>
<div class="ui-slider-handle ui-state-default ui-corner-all"
id="slider-handle-576875X1492X18245SQ001" style="left:
46.666666666666664%;"></div>
No comments:
Post a Comment