How to remove P tag from CkEditor in Laravel?
How to remove P tag from CkEditor in Laravel?
Hello everyone, in this post we will look at how to solve "How to remove P tag from CkEditor in Laravel?" in programming.
I am getting data from users and storing them into a database using ckeditor but I've noticed that for text, it adds `<p>` and `</p>` around the text. How can i remove this p tag after getting data from ckeditor before storing into the database in Laravel.-
Remove <p>, </p> tag from HTML using preg_replace()
//Get data using request $text = $request->ckeditor_data; $text = preg_replace("/^<p.*?>/", "",$text); $text = preg_replace("|</p>$|", "",$text);
It will remove only
<p>, </p>
tags surrounding the whole text. Like if you have HTML code<p>Lorem</p><p>Ipsum</p>
then it will return it will return "Lorem</p><p>Ipsum
". -
Remove all <p>, </p> tags from HTML using strip_tags()
$input = $request->ckeditor_data; $data = strip_tags($input);
If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.
Don't forget to share this article! Help us spread the word by clicking the share button below.
We appreciate your support and are committed to providing you valuable and informative content.
We are thankful for your never ending support.
Random Code Snippet Queries: Laravel
- Laravel save object to database
- Touch parent updated_at in Laravel
- Laravel API response format
- There are no commands defined in the "route:" namespace
- How to create controller in laravel
- Display first n record from collection in laravel view
- Retrieve count of nested relationship data in Laravel
- How to pass query string with pagination in laravel
- How to insert dynamic value to additional column in pivot table in laravel
- Pass variable from blade to controller Laravel
- SQLSTATE[42000]: Syntax error or access violation: 1055
- Route prefix with auth middleware in laravel
- How to get tomorrow and yesterday date in laravel
- How to pass variable from controller to model in Laravel
- How to get path from current URL in Laravel
- How to increment column value of table in Laravel
- How to restore deleted records in laravel
- Call to a member function update() on null
- How to get list of all views file in laravel
- Class 'Facade\Ignition\IgnitionServiceProvider' not found
- How to create belongstomany relation using custom name on custom pivot table
- How to Run CRON Job on LIVE SERVER on Cpanel in Laravel Project
- Ajax GET request in laravel
- How to print form data in laravel
- Permission denied error while creating storage link in Laravel