
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
- Delete file from amazon s3 bucket using Laravel
- Automatically remove records using Prunable trait in Laravel
- InRandomOrder() method with example in laravel
- How to get specific columns using with method in laravel Eloquent relationship
- PhpMyAdmin - Error The mysqli extension is missing
- How to insert multiple rows in mysql using loop in laravel?
- Where to use whereNotNull eloquent in laravel
- How to get session in blade Laravel ?
- Laravel delete all rows older than 30 days
- Laravel onclick function not working
- How to get date from created_at field in laravel
- Insert Comma Separated Values in laravel
- Global scope in Laravel with example
- How to get records in random order in laravel
- After image selected get validation error in laravel
- Declaration of App\Models\Post::sluggable() must be compatible with Cviebrock\EloquentSluggable\Sluggable
- Laravel get all records with pagination
- How to display validation error in laravel
- File_put_contents(/var/www/html/w3code/storage/framework/sessions/CXwN3EXKxERD6jgy3rADcaAAbAx8FRKih2JK7UO9): Failed to open stream: Permission denied
- Order by multiple columns in Laravel
- How to get tomorrow and yesterday date in laravel
- Ignore Records where a field has NULL value in Laravel
- How to add script on specific view file in laravel while extending layout
- How to add active class to menu item in laravel
- Send id with route Laravel