Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get value from jQuery UI slider?

I am working on http://gamercity.info/ymusic/. And I am using UI slider as seek bar. While the video is played I want to invoke a seekTo(seconds) function if user clicked anywhere on the seek bar. How to get new value of seconds after click event?

like image 931
atinder Avatar asked May 30 '10 18:05

atinder


People also ask

How to get slider value in jQuery?

Syntax: $( ". selector" ). slider("value");

What is jQuery slider?

jQuery UI slider is used to obtain a numeric value within a certain range. The main advantage of slider over text input is that it becomes impossible for the users to enter an invalid value. Every value they can pick with the slider is valid.

What is UI slider?

A control for selecting a single value from a continuous range of values.


2 Answers

To read slider value/percentage value at anytime:

var val = $('#slider').slider("option", "value"); 
like image 184
chad.mellor Avatar answered Sep 20 '22 15:09

chad.mellor


$('#slider').slider({     change: function(event, ui) {          alert(ui.value);      }  });​ 

http://jqueryui.com/demos/slider/

like image 23
Ben Avatar answered Sep 23 '22 15:09

Ben