crystyxn crystyxn - 4 years ago 101
jQuery Question

Bootstrap-slider won't load

I'm trying to get example #2 to work from here: http://seiyria.com/bootstrap-slider/

<!DOCTYPE html>
<html>

<head>
<link rel="stylesheet" href="css/bootstrap.css">
<link rel="stylesheet" href="css/bootstrap-slider.css">
<link rel="stylesheet" href="css/jquery-ui.css">
<script src="js/jquery-3.1.1.min.js"></script>
<script src="js/jquery-ui-1.12.1.js"></script>
<script src="js/bootstrap.js"></script>
<script src="js/bootstrap-slider.js"></script>

</head>
<body>
Filter by price interval: <b>€ 10</b> <input id="ex2" type="text" class="span2" value="" data-slider-min="10" data-slider-max="1000" data-slider-step="5" data-slider-value="[250,450]"/> <b>€ 1000</b>


</body>
</html>
<script>
$("#ex2").slider({});
</script>


What happens it just creates a small textbox instead of the slider. How can I make it display properly?

Answer Source

Remove your <link rel="stylesheet" href="css/jquery-ui.css"> and <script src="js/jquery-ui-1.12.1.js"></script> They are overriding the bootstrap-slider behaviour.

<!DOCTYPE html>
<html>

<head>
<link rel="stylesheet" href="css/bootstrap.css">
<link rel="stylesheet" href="css/bootstrap-slider.css">

<script src="js/jquery-3.1.1.min.js"></script>
<script src="js/bootstrap.js"></script>
<script src="js/bootstrap-slider.js"></script>

</head>
<body>
Filter by price interval: <b>€ 10</b> <input id="ex2" type="text" class="span2" value="" data-slider-min="10" data-slider-max="1000" data-slider-step="5" data-slider-value="[250,450]"/> <b>€ 1000</b>


</body>
</html>
<script>
$("#ex2").slider({});
</script>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download