javascript - Update jQuery UI Slide function -
i want code below function want able run slide function (slide: function(e,ui) {
) onclick of div when unitstandard
, unitmetric
changed. there way call function?
$('#weight').slider({ max: 450, min: 50, value: 115, animate: true, slide: function(e,ui) { if(unitstandard == true) { weight = math.floor(ui.value); $('#weightval').html(weight + " lbs"); } else if(unitmetric == true) { weight = math.floor(ui.value); weight = weight*0.453592; weight = math.floor(weight); $('#weightval').html(weight + " kg"); } } });
you can update calling value(v)
method documented in api.
for example:
$("#some-div").on("click", function() { $("#weight").slider("value", 200); });
here live example.
if don't give second argument $("#weight").slider("value")
, return current value of slide.
Comments
Post a Comment