JSFiddle - React, Tailwind, and code Playground

by Iftakharul Alam

HTML

<input type="text" id="SearchPostcode"/>

JavaScript

$('#SearchPostcode').on('blur',function(){

            var text = $('#SearchPostcode').val();
            text = text.replace(/ /g,'');
            var length = text.length;
            var first = text.substr(0,length-3);
            var last = text.slice(-3);
            var final = first+' '+last;
            $('#SearchPostcode').val(final);

    });