user1357913
user1357913

Reputation:

How to reset slider in the <div>?/ How to clear elements in <div>

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

Answers (5)

Veer7
Veer7

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

kannan
kannan

Reputation: 571

http://slidesjs.com/

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

scessor
scessor

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

Kanishka Panamaldeniya
Kanishka Panamaldeniya

Reputation: 17586

to reset the slider

   $("#value-slider").slider("value", $("#value-slider").slider("option", "min") );

to empty a div

$("#value-slider").empty();

Upvotes: 2

Marc Uberstein
Marc Uberstein

Reputation: 12541

It's a bit difficult to judge what exactly you want, but have a look at this :

reset jquery slider

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

Related Questions