The .val()
property of an item in jQuery for a doesn\'t seem to work with new lines. I need this function as the text-area is mean
I had tried to set the textarea value with jquery in laravel blade template, but the code was breaking because the variable had new lines in it.
my code snippet was
$("#textarea_id").val("{{ $php_variable }}");
I solved my problem by changing my code snippet like below.
$("#textarea_id").val("{{ str_replace(array('\r', '\n', '\n\n'), '\n', $php_variable }}");
if any of you are facing this problem may take benifit from this.