获取滑块'
Get slider's value jQuery
本文关键字:获取 更新时间:2023-09-26
我使用Dragdealer创建了一个滑块,但是我在读取滑块的值时遇到了问题。
这是我的HTML:<div id="just-a-slider" class="dragdealer">
<div class="handle red-bar">
<span class="value"></span>%
</div>
</div>
和Javascript来启用滑块:
new Dragdealer('just-a-slider', {
animationCallback: function(x, y) {
$('#just-a-slider .value').text(Math.round(x * 100));
}
});
如何读取用户选择的值?
例如,我想这样做:
var sliderValue = document.getElementById("just-a-slider").value;
// When the user clicks the Apply button an empty div gets the slider's value that the user selected
var greetingString = sliderValue;
document.getElementById("users_choice").innerText = greetingString;
这是小提琴