This would probably be most effective inside an MVC application because in Web Forms, you can do this easily by changing the attributes on the controls themselves, though, even still, this would be more efficient.

Here’s the scenario. You want to create a function for each and every textbox on your page, so that, when focus is lost (onblur), you perform some action on the textbox that lost focus.

In this case, the function will format the numbers in the textbox so that it will be in the format “0.00”. Technically, you create a function to create the function which will affect every textbox on the page:

var onblurTextFields=function(){
    $('input:text').blur(function () {
        var num = parseFloat($(this).val());
        var cleanNum = num.toFixed(2);

Then, inside your document ready tag, cll the base function: