Reputation:
I want to reset the <div id="slider">
on clicking certain button.
<div>
contains the slider (not important here).
is there any function like $(#slider).reset()
or $(#slider).clear()
or anything that clears the slider <div>
?
Upvotes: 2
Views: 5214
Reputation: 21493
There is a function empty()
which can suffice your need.
You can try
$("#slider").empty()
This will clear your <div>
so that you can reset some other slider on it again
Upvotes: 0
Reputation: 571
Sliderjs:
To reset to first slide, Apply the following line in cancel or close button click event $('.pagination li:first a').click();
http://letslearn-kannan.blogspot.in/
Upvotes: 0
Reputation: 16115
You can set a value, e.g. the minimum for this slider (0
):
$('#slider').slider("value", 0);
Also see this example.
To set to the maximum:
$('#slider').slider('value', $("#slider").slider("option", "max"));
Also see my updated example.
=== UPDATE ===
I've updated my example once more. Now you can alert the current value and set the maximum to 30 too:
$('#slider').slider('option', 'max', 30);
...
alert($('#slider').slider('value'));
Upvotes: 1
Reputation: 17586
to reset the slider
$("#value-slider").slider("value", $("#value-slider").slider("option", "min") );
to empty a div
$("#value-slider").empty();
Upvotes: 2
Reputation: 12541
It's a bit difficult to judge what exactly you want, but have a look at this :
How to reset a jQuery UI slider?
http://forum.jquery.com/topic/slider-moving-slider-back-to-beginning-slider-reset-method
Example :
$("#slider").slider("value", $("#slider").slider("option", "min") );
Upvotes: 1