View Single Post
  #3  
Old 10-24-2016, 09:23 AM
Irene S's Avatar
Irene S Irene S is offline
 
Join Date: Apr 2016
Posts: 52
Default

Hi,

This is Irene from Ecwid Customer Care Team. Thank you for posing this solution here - it may be very helpful for other Ecwid users!

As for this request in your message:

Quote:
The only thing I haven't managed to do is figure out how to limit the characters in the "Text Area" boxes - Maya's code only limits characters in the "Text Field" boxes. I expect there's a really simple answer to this... but I'm afraid I don't know it as I'm not great with computers... just learning what I can as I go.
I modified Maya's code a little. Please try this script to limit the number of characters in the "Text area" boxes for all product pages:

Code:
<script type="text/javascript">
Ecwid.OnPageLoaded.add(function(page){
  if (page.type == "PRODUCT") {  
     $("input.ecwid-productBrowser-details-optionTextArea").attr('maxlength','6');
  };
})
</script>
... and this one should be used for the particular product page:

Code:
<script type="text/javascript">
Ecwid.OnPageLoaded.add(function(page){
  if ((page.type == "PRODUCT") && (page.productId == "11111")) {  
     $("input.ecwid-productBrowser-details-optionTextArea").attr('maxlength','6');
  };
})
</script>
As before, you should change "11111" to the product ID. Also feel free to adjust the limit of characters changing '6' in this line .attr('maxlength','6') to any other number.

I hope it will help you! Let us know if any further questions appear.