The data get rendered as expected but on inspecting the code I can see an extra empty p tag like this <p></p> just below the </ul>
I have tried replacing p tags with string.empty but seems not working for list items.
How to remove this empty <p></p>
Anybody knows the solution?
update on June 8 2020
I changed my rendering code from @Html.Raw(HttpUtility.HtmlDecode(listItemDescription)) to @Html.Raw(library.RemoveFirstParagraphTag(listItemDescription)) Now i got my empty p tag in the begining and end got removed, But still the list items create empty p tag in mobile
-Regards Arun
Empty paragraph tag in Rich Text Editor. How to remove this empty <p> tags
Hi, I'm inserting List items inside Rich Text Editor and displaying it with
@Html.Raw(HttpUtility.HtmlDecode(listItemDescription))
The data get rendered as expected but on inspecting the code I can see an extra empty p tag like this
<p></p>
just below the</ul>
I have tried replacing p tags with
string.empty
but seems not working for list items.How to remove this empty
<p></p>
Anybody knows the solution?
Hi Arun,
Are you using Umbraco 7? in v7 you can use - umbraco.library.RemoveFirstParagraphTag
In Umbraco 8 there is no remove first paragraph method but you can find custom helper methods here - https://our.umbraco.com/forum/using-umbraco-and-getting-started/96264-v8-removefirstparagraphtag
Thanks,
Alex
Hi Alex,
I'm using Umbraco 7.12.3
-Arun
I've dealt with this. I solved it by using an ApplicationEventHandler and removed the extra spacing during the saving event. I can't find the v7 documentation for this, but v8 is here: https://our.umbraco.com/documentation/Reference/Events/ContentService-Events
Anyway, here's the relevant bits from our v7 class. As you'll see I'm doing a few more clean up items than just removing this space.
Thanks Tim,
I will check this
-Arun
is working on a reply...