The following example demonstrates the usage of three options min, max and step in the spinner widget of JqueryUI.


SUBMITTED BY: jlolk3r

DATE: Jan. 15, 2016, 8:53 a.m.

FORMAT: HTML

SIZE: 1.2 kB

HITS: 1314

  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>jQuery UI Spinner functionality</title>
  6. <link href="http://code.jquery.com/ui/1.10.4/themes/ui-lightness/jquery-ui.css" rel="stylesheet">
  7. <script src="http://code.jquery.com/jquery-1.10.2.js"></script>
  8. <script src="http://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
  9. <!-- CSS -->
  10. <style type="text/css">
  11. #spinner-2,#spinner-3 input {width: 100px}
  12. </style>
  13. <!-- Javascript -->
  14. <script>
  15. $(function() {
  16. $( "#spinner-2" ).spinner({
  17. min: -10,
  18. max: 10
  19. });
  20. $('#spinner-3').spinner({
  21. step: 100,
  22. min: -1000000,
  23. max: 1000000
  24. });
  25. });
  26. </script>
  27. </head>
  28. <body>
  29. <!-- HTML -->
  30. <div id="example">
  31. Spinner Min, Max value set:
  32. <input type="text" id="spinner-2" value="0" /><br><br>
  33. Spinner increments/decrements in step of of 100:
  34. <input type="text" id="spinner-3" value="0" />
  35. </div>
  36. </body>
  37. </html>

comments powered by Disqus