Skip to content

Instantly share code, notes, and snippets.

@adrianspeyer
Last active January 13, 2017 05:13
Show Gist options
  • Save adrianspeyer/b856ba93dffba2112a795fe08383097d to your computer and use it in GitHub Desktop.
Save adrianspeyer/b856ba93dffba2112a795fe08383097d to your computer and use it in GitHub Desktop.
If you are using the standard Hubspot forms on your landing pages and you need to limit the text area character count to ensure a Salesforce sync, as the limit is 255 characters. Add the following Javascript to your footer.
$(window).load(function() {
$('textarea').keypress(function(){
if(this.value.length > 255){
return false;
}
});
});
@adrianspeyer
Copy link
Author

adrianspeyer commented Dec 29, 2016

If you want a character count

<script>
$(window).load(function() {
 $('textarea').keypress(function(){
    if(this.value.length > 255){
        return false;
    }
    $("#CarCount").html("Remaining characters : " +(255 - this.value.length));
 });
});
</script>
<span id="CarCount'"></span>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment