raimond raimond - 7 months ago 42
HTML Question

Do labels in bootstrap-slider really need an ID?

Look at example #6 here: http://seiyria.com/bootstrap-slider/


<input id="ex6" type="text" data-slider-min="-5" data-slider-max="20" data-slider-step="1" data-slider-value="3"/>
<span id="ex6CurrentSliderValLabel">Current Slider Value: <span id="ex6SliderVal">3</span></span>


// With JQuery
$("#ex6").on("slide", function(slideEvt) {

Is the id="ex6CurrentSliderValLabel" necessary? It seems that it would be better without it and you should add it only if you have a need for it? Why did they add an id to the label?



The id="ex6CurrentSliderValLabel" is needed on that particular page to assign a style to that element.

Lines 100-102 of view-source:http://seiyria.com/bootstrap-slider/

#destroyEx5Slider, #ex6CurrentSliderValLabel, #ex7-enabled {
        margin-left: 45px;

The id is not needed for the example javascript to function, just for the style.