Forum Discussion
JohnnieMoore
7 days agoCommunity Member
How to insert a carriage return and line feed into a variable using javascript
How to insert a carriage return and line feed into a variable using javascript
- Nathan_HilliardCommunity Member
The simplest way is to just add <br> into the string where you want it to break. You can do this directly in Storyline when assigning the variable value.
Storyline accomodates some very basic formatting directly:
For more control, you can insert escape characters into the string in JavaScript:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#escape_sequences
Write the modified string back to a SL in the usual way using SetVar().
Keep in mind that SL textboxes will not automatically resize to accomodate dynamic content in variables. Make your text box the desired size and set to Do not autofit.
- JohnnieMooreCommunity Member
Wonderful, Thank you