| 1 | <!doctype html> |
| 2 | <html lang="en"> |
| 3 | <head> |
| 4 | <meta charset="utf-8"> |
| 5 | <meta name="viewport" content="width=device-width, initial-scale=1"> |
| 6 | <title>jQuery UI Spinner - Decimal</title> |
| 7 | <link rel="stylesheet" href="../../themes/base/all.css"> |
| 8 | <link rel="stylesheet" href="../demos.css"> |
| 9 | <script src="../../external/requirejs/require.js"></script> |
| 10 | <script src="../bootstrap.js" data-modules="external/globalize/globalize external/globalize/globalize.culture.de-DE external/globalize/globalize.culture.ja-JP"> |
| 11 | $( "#spinner" ).spinner({ |
| 12 | step: 0.01, |
| 13 | numberFormat: "n" |
| 14 | }); |
| 15 | |
| 16 | $( "#culture" ).on( "change", function() { |
| 17 | var current = $( "#spinner" ).spinner( "value" ); |
| 18 | Globalize.culture( $(this).val() ); |
| 19 | $( "#spinner" ).spinner( "value", current ); |
| 20 | }); |
| 21 | </script> |
| 22 | </head> |
| 23 | <body> |
| 24 | |
| 25 | <p> |
| 26 | <label for="spinner">Decimal spinner:</label> |
| 27 | <input id="spinner" name="spinner" value="5.06"> |
| 28 | </p> |
| 29 | <p> |
| 30 | <label for="culture">Select a culture to use for formatting:</label> |
| 31 | <select id="culture"> |
| 32 | <option value="en-EN" selected="selected">English</option> |
| 33 | <option value="de-DE">German</option> |
| 34 | <option value="ja-JP">Japanese</option> |
| 35 | </select> |
| 36 | </p> |
| 37 | |
| 38 | <div class="demo-description"> |
| 39 | <p> |
| 40 | Example of a decimal spinner. Step is set to 0.01. |
| 41 | <br>The code handling the culture change reads the current spinner value, |
| 42 | then changes the culture, then sets the value again, resulting in an updated |
| 43 | formatting, based on the new culture. |
| 44 | </p> |
| 45 | </div> |
| 46 | </body> |
| 47 | </html> |