简体   繁体   English

更新引导滑块的刻度值

[英]Update ticks value of bootstrap slider

I am trying to update the value of bootstrap slider on some changes made on the app. 我正在尝试在应用程序上进行一些更改时更新引导程序滑块的值。

it is giving this error : $(...).setAttribute is not a function . 它给出了此error : $(...).setAttribute is not a function

This issue is already being logged at gitHub https://github.com/seiyria/bootstrap-slider/issues/451 这个问题已经在gitHub上记录了https://github.com/seiyria/bootstrap-slider/issues/451

I have made the suggested changes 我已经提出了建议的更改

if (updateSlider === true) {
                    if (Array.isArray(this.options.ticks_labels) && this.options.ticks_labels.length > 0) { 
                        for (i = 0; i < this.options.ticks_labels.length; i++) {        
                            this.tickLabels[i].innerHTML = this.options.ticks_labels[i]
                        }
                    }
                }

and this is the code which is updating it . 这是更新它的代码。

function UpdateMonthSlider(month)
{
    var updtdArray = GetTicksArray(month.MonthMin, month.MonthMax, monthStep);
    $('#monthSlider').setAttribute("ticks", updtdArray);
    $('#monthSlider').setAttribute("ticks_labels",  GetFormattedLabels(updtdArray, 'months', false));
    $('#monthSlider').slider('refresh');
}

Sample fiddle to show the error: jsfiddle.net/mo6v9x7h/2 示例小提琴以显示错误: jsfiddle.net/mo6v9x7h/2

请尝试以下方法:

$('#monthSlider').slider('setAttribute', 'ticks', updtdArray);

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

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