Set step value for slider in JavaScript

Description

The following code shows how to set step value for slider.

Example


<!--from w  ww. j ava2 s .  c  o m-->

<html lang="en">
<head>
<title></title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></script>
<link type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/smoothness/jquery-ui.css" rel="stylesheet" />
<script type="text/javascript">
$(function() {
var sliderOpts = {
steps: 10
};

$("#mySlider").slider(sliderOpts);
});
</script>
</head>
<body>
<div id="mySlider"></div>
</body>
</html>

Click to view the demo

The code above generates the following result.

Set step value for slider in JavaScript