JQuery UI Slider - Snap to Increments Example

Admin   Jquery   538  2021-03-13 16:30:05

Hi Guys,

In this example,I will learn you how to use slider snap increment in jquery ui.you can easy and simply use slider snap increment in jquery ui.

jQuery UI also allows you to create a snap to increment Slider which has a set step size or interval to increment or decrement by.

Example :


<!doctype html>

<html lang="en">


<meta charset="utf-8">

<meta name="viewport" content="width=device-width, initial-scale=1">

<title>jQuery UI Slider - Snap to increments Example</title>

<link rel="stylesheet" href="http://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css" target="_blank" rel="nofollow" >

<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>

<style type="text/css">


margin:40px auto;




text-align: center;



background-color: #efcbaa;





<h2>JQuery UI Slider - Snap to Increments Example</h2>

<div class="content">


<label for="amount">Donation amount ($50 increments):</label>

<input type="text" id="amount" readonly style="border:0; color:#f6931f; font-weight:bold;">


<div id="slider"></div>







min: 0,

max: 500,

step: 50,

slide: function(event, ui) {

$("#amount" ).val("$" + ui.value);



$("#amount").val("$" + $("#slider").slider("value"));




It will help you....