如何从jQuery Select Slider获取值?

时间:2022-11-27 20:14:51

I'm using the Filament Group's jQuery Select Slider to produce a form for selecting a range of specific values.

我正在使用Filament Group的jQuery Select Slider来生成一个用于选择一系列特定值的表单。

How can I get the values of the slider and update <input> field?

如何获取滑块的值并更新字段?

$(function(){
    $('select').selectToUISlider({
        labels: 7
    });
    //fix color 
    fixToolTipColor();
});

I understand that I can get the values through the jQuery UI Slider through a change function. How would I do that?

我知道我可以通过更改函数通过jQuery UI Slider获取值。我该怎么办?

1 个解决方案

#1


The plugin already updates the 'select' element for which you have created UI Slider.

该插件已经更新了您为其创建UI Slider的'select'元素。

If you want to update another 'input' element, why not hook up the change event for your select and use it to update your input field.

如果您想更新另一个'input'元素,为什么不为您的select连接更改事件并使用它来更新您的输入字段。

$(function(){

    $('select')
        .selectToUISlider({ labels: 7 })
        .change(
                function()
                {
                    $('#myInputField').val(this.val());
                }
               );

        //fix color 
        fixToolTipColor();
});

#1


The plugin already updates the 'select' element for which you have created UI Slider.

该插件已经更新了您为其创建UI Slider的'select'元素。

If you want to update another 'input' element, why not hook up the change event for your select and use it to update your input field.

如果您想更新另一个'input'元素,为什么不为您的select连接更改事件并使用它来更新您的输入字段。

$(function(){

    $('select')
        .selectToUISlider({ labels: 7 })
        .change(
                function()
                {
                    $('#myInputField').val(this.val());
                }
               );

        //fix color 
        fixToolTipColor();
});