Trigger a jQuery UI slider event

前端 未结 12 2095
南方客
南方客 2020-12-02 22:04

How can I trigger a change event on a jQuery UI slider?

I thought it would be

$(\'#slider\').trigger(\'slidechange\');

but that do

12条回答
  •  生来不讨喜
    2020-12-02 22:57

    A good approach is simply to change the value of the slider. The slider's own change method should then respond to the change of value. For instance:

    var newValue=5;
    $('#slider').slider("value", newValue);
    

提交回复
热议问题