Limit Characters Entered in Other Textbox

Looking to limit the number of characters that can be entered in an Other Textbox? While we don't have this feature built in, it's something that can be accomplished with a little bit of custom JavaScript.

Check it out in an example survey!

OR

Download a survey with this script to your account!

To set the max characters for all other write-in fields in the survey copy and paste the below JavaScript in your the HTML of your survey them. To do so go to Style tab and scroll to the bottom of the survey preview to access the link to the HTML/CSS Editor. Paste the JavaScript the bottom of the HTML code on the Custom HTML tab.

<script>
$(function(){
  $('.sg-input-text-other').attr('maxlength', 10);
});
</script>

To get a little more specific with the other textboxes you affect you can add a custom class name to your question, and add that to the target in the script like so, where 'set-length' is the class name added to the question's Layout settings. Then copy and paste the below code to a JavaScript action on the page.

$(function(){
   $('.set-length .sg-input-text-other').attr('maxlength', 10);
});

Scripting and Other Custom Solutions

We’re always happy to help you debug any documented script that is used as is. That said, we do not have the resources to write scripts on demand or to debug a customized script.

If you have customization ideas that you haven't figured out how to tackle, we're happy to be a sounding board for Alchemer features and functionality ideas that might meet your needs. Beyond this, check out our Professional Services; these folks have the scripting chops to help you to achieve what you are looking for!

Basic Standard Market Research HR Professional Full Access Reporting
Free Individual Team & Enterprise
Feature Included In