Jquery Mobile Slider change event

后端 未结 10 1890
独厮守ぢ
独厮守ぢ 2021-01-02 11:14

I have a jquery mobile slider on a simple page. When I drag the slider, the value updates as expected in the textbox. I have looked but cannot find where this logic is happe

10条回答
  •  天命终不由人
    2021-01-02 11:42

    The documentation appears to be lacking. After searching for a long time I found that to get the new value in the event handler, something like $(this).slider().val() is needed (the extra slider() being the part omitted almost everywhere):

    $("#div-slider").change(function() {
      var slider_value = $(this).slider().val();
      // do something..
    });
    

提交回复
热议问题