set value in accounting format

set value in accounting format

HTML

<script src="https://raw.github.com/josscrowcroft/accounting.js/master/accounting.min.js"></script>
<input type="text" value="333333333333" id="txtamount1" />

JavaScript

$(document).ready(function () {
            $('#txtamount1').live('keyup change', function (e) {
                $(this).val(function () {
                    return accounting.formatMoney(($(this).val()+ String.fromCharCode(e.keyCode)), '', 2, ",");
                });
            });
     
            $('#txtamount1').trigger('keyup');
 });