Try It Editor
Tip: Press
Ctrl/⌘ + Enter
to Run
▶ Run
Reset
Copy
Download
Code
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Slider Range (Price Filter)</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <link rel="stylesheet" href="https://code.jquery.com/ui/1.13.2/themes/base/jquery-ui.css"> <script src="https://code.jquery.com/ui/1.13.2/jquery-ui.min.js"></script> <style> #priceSlider{width:300px;margin-top:20px;} </style> </head> <body> <p>Price range: $<span id="priceLabel">200 - 800</span></p> <div id="priceSlider"></div> <script> $(function(){ $("#priceSlider").slider({ range: true, min: 0, max: 1000, values: [200, 800], slide: function(e, ui){ $("#priceLabel").text(ui.values[0] + " - " + ui.values[1]); } }); }); </script> </body> </html>
Output