I am using jQuery and jQuery UI Slider to display some controls on my HTML page, and I want to set the slider range from an attribute in my HTML.
Here is the code I use to initialize the sliders ...
$( ".slider" ).slider(
{
range: "min",
value: 0,
min: 0,
max: 5,
slide: handleSlide
}
);
Of course, the maximum value is hardcoded. What I would like to do in my code is ...
<div class="slider" id="sliderA" max="10"></div>
but I can’t figure out how to get the attribute during selection.
I thought that I have access to it through this, as in JQuery .each(), but firebug tells me that this is a document, so it does not work.
I want to do something like ...
$( ".slider" ).slider(
{
range: "min",
value: 0,
min: 0,
max: blah.getAttribute("max"),
slide: handleSlide
}
);
but I can’t understand what could be blah.
? , JQuery , , - , , .