Jquery Focusout not triggering
<p>I have a textbox where the text wil be formatted using a function with some regular expressions. The function is tested and works fine.
When adding underneath code that should bind a focusout event to the specific textbox for reformatting the text, but the function isn't triggered. </p>

<pre><code>$(document).ready(function() {
    $('#PostcodeTextBox').focusout(function() {
        $('#PostcodeTextBox').val(PostcodeFormatting($('#PostcodeTextBox').val()));
    });
    $('#PostcodeTextBox').blur(function() {
        $('#PostcodeTextBox').val(PostcodeFormatting($('#PostcodeTextBox').val()));
    });
})


function PostcodeFormatting(pc) {
    var reg = /^([1-9]\d{3})\s?([a-z]{2})$/i;
    var postcode = $.trim(pc);
    if (postcode &amp;&amp; postcode.match(reg)) {
        return postcode.replace(reg, "$1$2").toUpperCase();
    }
    else {
        return "Postcode incorrect";
    }
};
</code></pre>

<p>what am I doing wrong or what do I forget. </p>
