如何在jQuery中设置滑块的值?

时间:2023-01-27 14:41:36

I have a jQuery slider on my page having min -100 and max 100 and startValue 0. I want to provide a reset button which will reset the slider value to 0.

我的页面上有一个jQuery滑块,最小-100,最大100和startValue 0.我想提供一个重置按钮,它将滑块值重置为0。

I am not able to find any setter function to do that, how can I do this?

我无法找到任何setter函数来做到这一点,我该怎么做?

2 个解决方案

#1


As i can see you can get or set the value of the slider:

我可以看到你可以获取或设置滑块的值:

$("#slider).slider('value', 0);

http://docs.jquery.com/UI/Slider/slider#.22value.22value

#2


Would this do the trick?

这会诀窍吗?

$("#slider").slider("value",0);

#1


As i can see you can get or set the value of the slider:

我可以看到你可以获取或设置滑块的值:

$("#slider).slider('value', 0);

http://docs.jquery.com/UI/Slider/slider#.22value.22value

#2


Would this do the trick?

这会诀窍吗?

$("#slider").slider("value",0);