Hello @tvgarden
you need to create the on change event of that element and fire your js code.
This didn't work:
$( 'input[name="postcode"]' ).on( "change", function() { console.log(getPostcode()); });
You need to keep below js into your js file,
$( document ).on( "change",'input[name="postcode"]', function() { console.log(getPostcode()); });