I am trying to get the current value of a jQuery-UI slider in a JavaScript function and it is not working. If I do
$("#someParticularDOMObject").find(".slider").first()
in FireBug, it returns the correct
[ div.slider ]
that I’m trying to select, but when I ask it for
$("#someParticularDOMObject").find(".slider").first().slider("value")
it doesn’t return the value; it just returns the div again:
[ div.slider ]
Any thoughts as to why this wouldn’t work/what I’m doing wrong?
PS: I get the same behavior in Safari.
PPS: I am using jQuery version 1.5.1, but could update to current release if necessary.
There are two ways to access the current value of the slider, one method can be accesed from anywhere in the script (after the slider has been initially bound) like so:
Or from within any of the slider events:
I find that the latter tends to give more accurate values at times, but possibly only when it comes to decimals.
Other options, events and methods can be found at the bottom of the page from that link you gave.