Forum Discussion
Display value of variable with line-breaks when populated from javascript
I'm working on a template project where the variables get populated from a javascript that defines and adds the values to the variables.
There is one variable that will often be quite long. I want to include js code that will add a break every 3 lines. But can't do it.
Any ideas?
- MathNotermans-9Community Member
Looks solid. Recapping how i think it works ( should work ) checking your images.
- sentences are split on a .
- all sentences are added to formattedCxScenario
- a . is added to the end.
- i is checked
- when (i +1) % 3 === 0 it will return true
- when true a <br> is added.
Looks correct...
I would add a console.log("i : "+i);
to check if i is the value you need...
add it just before the if and in the check...so you can see the result. - BenKanspedos-8bCommunity Member
- Jürgen_Schoene_Community Member
you have to change "<br>" to "\n" - storyline don't use internal html breaks
- MathNotermans-9Community Member
Jurgen is correct ( as ususal ;-))
- BenKanspedos-8bCommunity Member
- Jürgen_Schoene_Community Member
a have created a small example and "<br>" and "\n" is working for me
https://360.articulate.com/review/content/2227beab-6233-4a29-8ffd-07e855ffc7e7/review
upload your (reduced) .story file