Introduction
Slider controls are widely used in modern websites to zoom the object, indicate the temperature level, and so on. In this blog, you will learn how to implement the kendo rating control using jQuery and how to fetch the values from the control, based on the selection.
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>Kendo Slider</title>
-
- <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2021.1.119/styles/kendo.common.min.css">
- <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2021.1.119/styles/kendo.rtl.min.css">
- <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2021.1.119/styles/kendo.default.min.css">
- <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2021.1.119/styles/kendo.mobile.all.min.css">
-
- <script src="https://code.jquery.com/jquery-1.12.3.min.js"></script>
- <script src="https://kendo.cdn.telerik.com/2021.1.119/js/angular.min.js"></script>
- <script src="https://kendo.cdn.telerik.com/2021.1.119/js/jszip.min.js"></script>
- <script src="https://kendo.cdn.telerik.com/2021.1.119/js/kendo.all.min.js"></script></head>
- <body>
- <div id="example">
-
- <input id="slider" class="temperature" />
-
- </div>
- <script>
- function sliderOnSlide(e) {
- console.log("On Slide value:" + e.value);
- }
-
- function sliderOnChange(e) {
- console.log("On Change value:" + e.value);
- }
- $(document).ready(function() {
- $("#slider").kendoSlider({
- change: sliderOnChange,
- slide: sliderOnSlide,
- min: 0,
- max: 30,
- value: 18
- });
-
-
- });
- </script>
- </body>
- </html>
In the above code, you can see how Kendo slider control is initialized with some properties,
- min – defines the minimum value
- max – defines the maximum value
- value – default slider value
- change- the change event which will be captured when there is a change in the value
- slide – the slide event is used to capture the value when the user uses the slider.
Summary
We have seen how to implement the kendo slider control using jQuery, and work with a change and slide event in regards to the slider control.