Skip to content

Instantly share code, notes, and snippets.

@victorzen
Last active April 16, 2016 01:00
Show Gist options
  • Save victorzen/a73c2b4cc5a0cccf90c6 to your computer and use it in GitHub Desktop.
Save victorzen/a73c2b4cc5a0cccf90c6 to your computer and use it in GitHub Desktop.
Limit the number of characters allowed in a form field.

Some services that integrate with Unbounce impose a maximum number of characters, including spaces, that you can add into a field.

For example MailChimp, Campaign Monitor, Constant Contact and Zoho CRM allow a maximum number of around 250 characters, while other services like AWeber have a limit of between 16 to 33, depending on the type of characters.

In order to avoid integration errors, you can limit the amount of characters allowed in your form fields by adding the following script to the Javascripts section of your page, selecting "Before Body End Tag" as the placement:

<script> 
$(document).ready(function(){

//Change 'email' for the ID of your form field and '10' for the max number of characters allowed. 
    $("#email").attr('maxlength','10');
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment