Build jQuery UI Spinner - Currency in JavaScript
Description
The following code shows how to build jQuery UI Spinner - Currency.
Example
<!-- Revised from demo code on http://jqueryui.com/ -->
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Spinner - Currency</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" />
<!--from w w w . ja v a2s . c o m-->
<script>
$(function() {
$( "#currency" ).change(function() {
$( "#spinner" ).spinner( "option", "culture", $( this ).val() );
});
$( "#spinner" ).spinner({
min: 5,
max: 2500,
step: 25,
start: 1000,
numberFormat: "C"
});
});
</script>
</head>
<body>
<p>
<label for="currency">Currency to donate</label>
<select id="currency" name="currency">
<option value="en-US">US $</option>
<option value="de-DE">EUR ?</option>
<option value="ja-JP">YEN ?</option>
</select>
</p>
<p>
<label for="spinner">Amount to donate:</label>
<input id="spinner" name="spinner" value="5">
</p>
<div class="demo-description">
<p>Example of a donation form, with currency selection and amount spinner.</p>
</div>
</body>
</html>
The code above generates the following result.
Javascript Tutorial Spinner
Build jQuery UI Spinner - Default functiona...
Build jQuery UI Spinner - Map in JavaScript
Build jQuery UI Spinner - Overflow in JavaS...
Build jQuery UI Spinner - Time in JavaScrip...
Build jQuery UI Spinner - Currency in JavaS...
Build jQuery UI Spinner - Decimal in JavaSc...Build jQuery UI Spinner - Default functiona...
Build jQuery UI Spinner - Map in JavaScript
Build jQuery UI Spinner - Overflow in JavaS...
Build jQuery UI Spinner - Time in JavaScrip...