Add comma to textbox every three digits using jQuery
<p>I want to add comma to numbers every three digits on Textboxes.<br>
I'm using this code but it not works.
Where am I wrong?</p>

<pre><code>  $(function () {
        $.fn.digits = function () {

            return this.each(function () {
                $(this).val($(this).val().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,"));
            })
        }
        $("#Test").bind("change keyup keydown paste blur", function (e) {

            $("#Test").digits();
        });

    });
</code></pre>
