Knockout Paragraph Binding
Demonstrates knockout binding behavior for carriage returns
by pkpjpm
HTML
<script src="http://github.com/downloads/SteveSanderson/knockout/knockout-2.1.0.js"></script>
<h4>My Text With Carriage Returns</h4>
<section data-bind="text:theText"></section>
CSS
body { font-family: Arial, Helvetica, sans-serif; }
JavaScript
var textWithCr = "Now is the time for all good men"
+ "\r\n\r\n\r\n\r\nto come to the aid of <their> party";
var vm = {
theText : ko.observable(textWithCr)
};
ko.applyBindings(vm);