validate zip code only when whole zip has been entered

by tom harrison   Last Updated May 16, 2018 14:09 PM - source

I am trying to change the validation on my zip code so that instead of validating on every key press , it will validate once the user has input the full zip code (5 numbers) , or if the user leaves the field.

What do I need to change to do this?

I have the following validation on the input:

<input class="input-text" type="text" data-bind="
    value: value,
    valueUpdate: '',
    hasFocus: focused,
    attr: {
        name: inputName,
        placeholder: placeholder,
        'aria-describedby': noticeId,
        id: uid,
        disabled: disabled
    }" name="postcode" placeholder="" aria-describedby="notice-KG9VXWK" id="KG9VXWK">

Related Questions

Magento 2 checkout input field validation possibility

Updated December 28, 2017 14:09 PM

Adding custom global javascript validation

Updated June 18, 2016 08:03 AM