
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
- How to send ID to another page in Laravel
- How to add active class to menu item in laravel
- How to display 1 day ago in comments in laravel view
- How to display validation error in laravel
- How to get all route list
- How to return a column with different name in Laravel
- Target class [HomeController] does not exist
- Ajax GET request in laravel
- Redirect to another view from controller in laravel
- Print query in laravel
- Update email with unique validation in laravel
- Sample configuration files to create laravel project with docker using wsl (window subsystem linux)
- How to delete record in Laravel with ajax
- Calculate age from date of birth in Laravel
- Symlink(): No such file or directory
- How to get list of all views file in laravel
- How to Get records between two dates in Laravel
- How to get query string value in laravel
- Print last executed query in laravel
- How to get the id of last record from collection object in laravel view
- Link storage folder in laravel 8
- Global scope in Laravel with example
- How to validate URL with https using regex in laravel
- Get last week data in Laravel
- Get only 10 records from table in laravel