In this tutorial you will learn how to format currency using jquery plugin jQuery Format Currency plugin 1.4.0 . Using this plugin you can easily do what you want without any need to write code. Let's have a look over how to do so
format currency using jquery plugin
<script src="js/jquery-1.4.2.js" type="text/javascript"></script>
<script src="js/jquery.formatCurrency-1.4.0.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
$(document).ready(function () {
$("#firstDiv").text("$44").formatCurrency();
$("#secondDiv").text("$200").formatCurrency();
$("#thirdDiv").text("$0.700").formatCurrency();
$("#fourthDiv").text("$20000000").formatCurrency();
$("#fifthDiv").text("$8000000000").formatCurrency();
});
</script>Include jquery and jquery format currency plugin in your webpage.
Let's have a look over html code
<body>
<div>
<div id="firstDiv">
</div>
<div id="secondDiv">
</div>
<div id="thirdDiv">
</div>
<div id="fourthDiv">
</div>
<div id="fifthDiv">
</div>
</div>
</body>Output will be
$44.00
$200.00
$0.70
$20,000,000.00
$8,000,000,000.00
I have also written a tutorial in javascript about Format the currency using javascript. I hope you will find this article very helpful.
Happy Coding!!!

0 comments:
Post a Comment