How do I insert a space after a character in a textbox, depending on the total characters entered, JQuery?
<p>Is it possible to add a space in a textbox depending on the total characters entered by the user.</p>

<p>For example if the user entered 'LU33RT' on blur I'd like it to display 'LU3 3RT'. The rule that I'm looking to incorporate is by counting 3 characters in from the right then add a space.</p>

<p><code>$('#postcode').blur(...</code> </p>

<p>Any help would be greatly appreciated, Thanks</p>

<hr>

<p>My Solution, Although it's basic:</p>

<pre><code>$(document).ready(function(){

    $('#postcode').blur(function(){
        if(($(this).val().length == 6) &amp;&amp; (/\S/)){
           var myString = $(this).val().slice(0, 3);
           var myString2 = $(this).val().slice(-3);
           $(this).val(myString + ' ' + myString2);
        }else{ 
            document.write('OOPS!');}
    }); 
});
</code></pre>
