textarea line breaks javascript-Collection of common programming errors
Maybe someone find this useful:
I had problem with line breaks which were passed from server variable to javascript variable, and then javascript was writing them to textarea (using knockout.js value bindings).
the solution was double escaping new lines:
orginal.Replace("\r\n", "\\r\\n")
on the server side, because with just single escape chars javascript was not parsing.
Originally posted 2013-11-15 09:08:28.