User-2026864067 posted
I have added TinyMCE to my project. I have styled text and sent its value to database. Then I want it to be shown in the view. But it shown in HTML tags. How can I get rid of HTML tags?
Js:
<script>
tinymce.init({
selector: '#Content',
height: 500,
theme: 'modern',
plugins: [
'advlist autolink lists link image charmap print preview hr anchor pagebreak',
'searchreplace wordcount visualblocks visualchars code fullscreen',
'insertdatetime media nonbreaking save table contextmenu directionality',
'emoticons template paste textcolor colorpicker textpattern imagetools'
],
forecolor: { inline: 'span', classes: 'forecolor', styles: { color: '%value' } },
hilitecolor: { inline: 'span', classes: 'hilitecolor', styles: { backgroundColor: '%value' } },
custom_format: { block: 'h1', attributes: { title: 'Header' }, styles: { color: 'red' } },
toolbar1: 'insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image',
toolbar2: 'print preview media | forecolor backcolor emoticons ',
image_advtab: true,
});
</script>
View:
@foreach (Blog blog in Model.Blog)
{
@blog.posttext
}
posttext
is shown like: <p><span style="color: #008080; background-color: #33cccc;">hi</span></p>