In this post, I will show you how to break lines for Textarea in laravel blade. Many times when you save some text in the text area and save it into the database, but when you want to display or print the same data that time it is showing in the same single line and you didn't get proper output. So, at that time we are using PHP function nl2br() in the blade file.
Laravel helper provides many functionalities and you can use e
Laravel helper function to purify your HTML before showing line breaks. whenever you want to preserve saved line breaks in the Textarea field in the laravel blade we are using the PHP nl2br() function. So, we will break code or newlines.
nl2br — Inserts HTML line breaks before all newlines in a string. The nl2br() function inserts HTML line breaks (<br> or <br />) in front of each newline (\n) in a string.
You need to do the escaping first using e()
and then after apply nl2br() function.
{{ nl2br(e($data)) }}
// OR
{!! nl2br(e($data)) !!}
In this article we will see jquery appendTo() and prependTo example. The appendTo() method inserts HTML elements at...
Dec-13-2021
In the interconnected world of web development, where applications are accessed by users spanning multiple time zones, t...
Sep-04-2023
In this article, we will see a jquery datatable hide/show column based on condition. Here, we will learn how to hide and...
Jan-26-2023
In this artical we will see laravel 9 yajra datatable example. As we all used datatable on our backend side project, Her...
Mar-10-2022