Using knockout.js, how do I include a carriage return in the text that is bound to the text attribute of a paragraph element.
In my ViewModel I g
You need to set a css property in your element. white-space: pre-wrap
First name: todo Last name: todo function AppViewModel() { this.firstName = "Bert" + " \n " + "Test"; this.lastName = "Bertington"; } // Activates knockout.js ko.applyBindings(new AppViewModel());
First name: todo
Last name: todo
Then the code works. with \n
\n