简体   繁体   English

如何从jQuery Select Slider获取值?

[英]How to Get Values from jQuery Select Slider?

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? 如何获取滑块的值并更新<input>字段?

$(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. 我知道我可以通过更改函数通过jQuery UI Slider获取值。 How would I do that? 我该怎么办?

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();
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM