Jump to content
  • 0

Установить значение для bootstrap-slider


mstdmstd
 Share

Question

Всем привет,
На странице ссылка  есть
"Filter on rating" блок со слайдером как описано тут
Описание
и тут примеры
Демо

Слайдер работает но не удается програмно средствами JS установить значение для этого слайдера
Ниже 2 кнопки для тестирования


"test Value 1" с кодом

function testValue1() {
  alert( "testValue1 nsn_woo_ext_search_ratingSlider::"+var_dump(nsn_woo_ext_search_ratingSlider) )
  nsn_woo_ext_search_ratingSlider.slider('setValue', 1).slider('setValue', 5);
}

и выдает ошибку
Error: cannot call methods on slider prior to initialization; attempted to call method 'setValue'

"test Value 2"  с кодом

function testValue2() {
  alert( "testValue1 nsn_woo_ext_search_ratingSlider::"+var_dump(nsn_woo_ext_search_ratingSlider) )
  nsn_woo_ext_search_ratingSlider.bootstrapSlider('setValue', 1).bootstrapSlider('setValue', 5);
}

и выдает ошибку

bootstrap-slider.min.js?ver=4.6.1:29 Uncaught TypeError: Cannot read property 'toFixed' of undefined


Ошибки ссылаются на библиотечные файлы...

nsn_woo_ext_search_ratingSlider - это глобальная переменная которая инициализирется кодом

    nsn_woo_ext_search_ratingSlider = $("#"+this_m_plugin_prefix+"rating_slider").bootstrapSlider();
    alert( "initRating  nsn_woo_ext_search_ratingSlider::"+var_dump(nsn_woo_ext_search_ratingSlider) )


при инициализации jQuery


сам слайдер имеет код
 

  <input id="zenda-fonda_bread_rating_slider" type="text" class="span2" value="" data-slider-min="1" data-slider-max="5" data-slider-step="1" data-slider-value="[1,5]" style="width: 100%" data-slider-ticks="[1, 2, 3, 4, 5]" data-slider-ticks-labels='["1", "2", "3", "4", "5"]'/>


 
 
  А как правильно ?

  Спасибо !

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. See more about our Guidelines and Privacy Policy