slider html css js code example

Example 1: create a slider

<input className="newpost-rating-slider" type="range" name="rangeInput" 
min="0" max="5" onChange={handleSliderRating} />

<span className="slider-rating-field">0/5</span>



const handleSliderRating = () => {

        var curVal = document.querySelector('.newpost-rating-slider').value;
        var sliderRatingEle = document.querySelector('.slider-rating-field');

        sliderRatingEle.textContent =   curVal.toString() + "/5";
    
    }

Example 2: slider js

$('.multiple-items').slick({
  infinite: true,
  slidesToShow: 3,
  slidesToScroll: 3
});

Example 3: slider

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>jQuery UI Slider - Default functionality</title>
  <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
  <link rel="stylesheet" href="/resources/demos/style.css">
  <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
  <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
  <script>
  $( function() {
    $( "#slider" ).slider();
  } );
  </script>
</head>
<body>
 
<div id="slider"></div>
 
 
</body>
</html>