alpaca
Version:
Alpaca provides the easiest and fastest way to generate interactive forms for the web and mobile devices. It runs simply as HTML5 or more elaborately using Bootstrap, jQuery Mobile or jQuery UI. Alpaca uses Handlebars to process JSON schema and provide
137 lines (104 loc) • 3.19 kB
HTML
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript" src="../../jquery.price_format.min.js"></script>
<script type="text/javascript">
$(function(){
$('#example1').priceFormat();
$('#example2').priceFormat({
prefix: 'R$ ',
centsSeparator: ',',
thousandsSeparator: '.'
});
$('#example3').priceFormat({
prefix: '',
thousandsSeparator: '',
clearOnEmpty: true
});
$('#example4').priceFormat({
limit: 2,
centsLimit: 1
});
$('#example5').priceFormat({
clearPrefix: true
});
$('#example6').priceFormat({
allowNegative: true
});
$('#example7').priceFormat({
prefix: 'R$',
suffix: '$$',
clearSuffix: true,
clearPrefix: true
});
$('#example8').priceFormat({
prefix: '',
thousandsSeparator: '',
insertPlusSign: true
});
$('#example9').priceFormat();
$("#unmask-test").click(function(){
alert($('#example6').unmask());
});
$("#unprice-test").click(function(){
$('#example7').unpriceFormat();
});
$("#price-test").click(function(){
$('#example7').priceFormat({
prefix: 'R$',
suffix: '$$',
clearSuffix: true,
clearPrefix: true
});
});
$('#htmlfield').priceFormat({
prefix: 'R$ ',
centsSeparator: ',',
thousandsSeparator: '.',
insertPlusSign: true
});
});
</script>
</head>
<body>
<h1>JQuery Price Format Examples</h1>
<p>
Basic usage
<input type="text" value="" id="example1" name="example1">
</p>
<p>
Customize
<input type="text" value="123456" id="example2" name="example2">
</p>
<p>
Skipping some option and Cleanup on Empty
<input type="text" value="123456" id="example3" name="example3">
</p>
<p>
Working with limits
<input type="text" value="123456" id="example4" name="example4">
</p>
<p>
Clear Prefix and Suffix on Blur
<input type="text" value="123456" id="example5" name="example5">
</p>
<p>
Allow Negatives and Unmask function
<input type="text" value="-123456" id="example6" name="example6">
<button id="unmask-test">Return Value Unmask</button>
</p>
<p>
Add Suffix
<input type="text" value="123456" id="example7" name="example7">
<button id="unprice-test">Unprice Format</button>
<button id="price-test">Price Format</button>
</p>
<p>
Using the plus sign
<input type="text" value="123456" id="example8" name="example8">
</p>
<h4 id="htmlfield">
1234567
</h4>
</body>
</html>