0

I am trying to display strings in Adobe Captivate 9 text captions with JavaScript. I'm using a non-responsive project, and the below code always shows the first "br" tag for newline. If I'm to remove the "br" tags in userResults then the "br" tag in topTenUsers will be seen.

However, in a responsive project, the same code does not show any of the "br" tags.

Code:

    var userResults = 'You placed at rank ' + myRank + ' with a score of ' + myScore + '<br>' + '<br>';
    var topTenUsers = 'The top ' + numPlayers + ' users are: <br>';
    var topTenMsg = userResults + ' ' + topTenMsg;

    window.cpAPIInterface.setVariableValue(topTenVarName, topTenMsg);

What is the cause of this difference and how could it be avoided?

user2871213
  • 41
  • 1
  • 9
  • variables do not match in your code sample... – epascarello Nov 01 '16 at 23:24
  • I've added the line which concatenates the two variables. I've kept the code shown as simple as possible, as the real code is speaking with servers. The problem only stems from the first two lines. – user2871213 Nov 01 '16 at 23:56

1 Answers1

0

Try a self-closing br.

var userResults = 'You placed at rank ' + myRank + ' with a score of ' + myScore + '<br />' + '<br />'
Phillip Chan
  • 993
  • 7
  • 17