bootstrap-slider
bootstrap-slider copied to clipboard
Issues when using .slider class for slider handle
I was using .slider
class for my slider handle element like this <div class="slider"></div>
and then I had problems when calling $('.slider').slider('setValue', 5);
. I got a cannot call methods on slider prior to initialization
error, this is because one of the elements bootstrap-slider creates has a .slider
class.
It would be nice to have a warning about this in the readme.md or to change the class name to something less common. ^^
I think it's easier for you to add .slider-container
(instead of .slider
-- it's more explicit as to what it does) or hold references separately, sorry. The error is there to let you know something's going wrong.
yes, you're right, I shouldn't have called it .slider
, but I think it's a common mistake to make. The error itself is not a problem, a note about this in the readme would be nice never the less.
I had exactly the same issue by giving my slider container-div's the "slider" class. Would be nice if the internal slider classes are less obvious to override.
Or maybe use some kind of prefix for the slider class name.
Would some sort of console warning be good to indicate to the developer that the classname they selected for the slider container is invalid?
@rovolution Console warning would be a big improvement! Maybe with reference to the doc. (Can we reopen this issue ^^)