Skip to content

Instantly share code, notes, and snippets.

@matheuswd
Created December 8, 2020 11:43
Show Gist options
  • Save matheuswd/c30fa2f1de28c0b5b6574c03099339c3 to your computer and use it in GitHub Desktop.
Save matheuswd/c30fa2f1de28c0b5b6574c03099339c3 to your computer and use it in GitHub Desktop.
Limits the ZIP Code field for 5 digits only
<?php
function my_give_limit_zip_length() { ?>
<script>
let zipcodes = document.querySelectorAll('input#card_zip');
zipcodes.forEach(zipcode => zipcode.setAttribute('maxlength', 5));
</script>
<?php }
add_action( 'give_donation_form_after_submit', 'my_give_limit_zip_length' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment