Set character limit on personalisation block | Community
Skip to main content
Level 2
September 17, 2024
Solved

Set character limit on personalisation block

  • September 17, 2024
  • 2 replies
  • 1024 views

Hello, 
I'm wondering if there's a way to set a character limit on copy coming through from a personalised piece of content so it can be truncated 

For instance
<%= targetData.Description %> will return: 
Lorem ipsum dolor sit amet, consectetur adipiscing elit

 

Where the ideal will be for it to return:
Lorem ipsum dolor sit amet ...

Any help would be appreciated

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by ashish1212

You can use textarea max length (maxlength="50") this is in the HTML property best of HTML

 

You can add is CSS and can be utilized in all over HTML

2 replies

ashish1212
Level 2
September 17, 2024

@andyhu5  where exactly you want to use it.  If this is to display in email, there is other way around to achive it.

AndyHu5Author
Level 2
September 18, 2024

Hi @ashish1212 , thanks for the reply

Yes this being used in an email, image example attached

Ideally I want to to do this in a the script as it may be needed elsewhere with a different character limit

ashish1212
ashish1212Accepted solution
Level 2
September 19, 2024

You can use textarea max length (maxlength="50") this is in the HTML property best of HTML

 

You can add is CSS and can be utilized in all over HTML

DavidKangni
Community Advisor
Community Advisor
September 18, 2024

Hi @andyhu5 ,

If you need to truncate after a specific number of character you can use slice.

If you need to truncate after a specific word then you need a combination of index and slice.

 

Thanks,

David

David Kangni