I faced a problem with laravel blade template with javascript.
I have textarea and cancel button that return the textarea value to it's original value. But when the original value have multi-line, there error in script, because the blade print the value into the new line not \n in value.
Blade syntax:
$('#my-textarea').val('{{ $oldValue }}');
In html page source:
$('#my-textarea').val('old
value
with
multiline');
That one will cause error syntax in javascript
Uncaught SyntaxError: Invalid or unexpected token
Expected result:
$('#my-textarea').val('old\nvalue\nwith\nmultiline');
The question is, how can i print the value without being converted to actual new line but char \n
?