Ask The jQuery Experts!
Have a jQuery question you’d like answered or a topic explorer? Post a comment below and I may be able to help! Unfortunately, I am not able to answer or personally respond to every submission I receive but I’ll pick the best ones and share with the community!
Cheers,
- Jonathan
can u provide me with a jquery text slider
sidhartha
3 Oct 09 at 10:24 am
Hi,
I am new to jquery and I am trying to calculate a value based on two sliders.
I can calculate based on one, but I am not sure how or where to put the var’s in order to pick up both slider values.
Thanks,
Dejan R.
This is the code that I am using:
var value1;
var value2;
$(function() {
$(“#slider”).slider({
value:0,
min: -100,
max: 100,
step: 1,
slide: function(event, ui) {
$(“#amount_t”).val(ui.value);
var sl1 = parseFloat(ui.value / 100) * parseFloat($(“#rate”).attr
(“value”));
$(“#amount1_t”).val(sl1);
value1 = sl1;
}
});
$(“#slider1″).slider({
value:0,
min: -100,
max: 100,
step: 1,
slide: function(event, ui) {
$(“#amount_b”).val(ui.value);
var sl2 = parseFloat(ui.value / 100) * parseFloat($(“#rate”).attr
(“value”));
$(“#amount1_b”).val(sl2);
value2 = sl2;
}
});
var calc = parseFloat(value1) + parseFloat(value2);
$(“#total”).val(calc);
});
Dejan R.
15 Oct 09 at 8:31 am