---
title: "How to decode html value of editor in mvc?"  
description: "How to decode html value of editor in mvc?"  
author: "Anonymous User"  
published: 2018-03-16  
updated: 2018-03-16  
canonical: https://www.mindstick.com/forum/34438/how-to-decode-html-value-of-editor-in-mvc  
category: "c#"  
tags: ["asp.net mvc", "mvc"]  
reading_time: 2 minutes  

---

# How to decode html value of editor in mvc?

Hi,

I want to decode [editor](https://www.mindstick.com/forum/78/how-avoid-the-html-tag-and-remove-the-formating-of-copy-in-ajax-editor) [value in jquery](https://www.mindstick.com/forum/34521/how-to-get-drop-down-selected-value-in-jquery). Please give me some idea to achieve this task.

The [code](https://yourviews.mindstick.com/view/85458/alan-turing-the-mastermind-behind-cracking-the-enigma-code-during-world-war-ii) is as follows:

```
<div class="form-group">            <label for="description">Description</label>            @Html.TextAreaFor(x => x.Content, new { @style = "min-width: 100%;max-width: 100%", rows = "10", @class = "DescriptionEditor" })        </div>
```

```
$('#Content').summernote({          height: 280,
          callbacks: {
               onPaste: function (e) {
                    var bufferText = ((e.originalEvent || e).clipboardData || window.clipboardData).getData('Text');
                    e.preventDefault();
                    document.execCommand('insertText', false, bufferText);
                }
            }
 });
```

## Replies

### Reply by Hemant Patel

Hi Clara,

I analyzed your code. You can easily decode your editor [value](https://www.mindstick.com/articles/23219/an-optimized-description-adds-value-to-experience-and-in-turn-effectively-guest-posting-packages) by using the following line of code:

**Step 1:** First of all get editor value using class name *(you can also use name or id of the element)*.

```
 var editorVal = $('.DescriptionEditor').val();
```

**Step 2:** Create a method to decode editor value.

```
 function DecodeHtml(str) {
        return $('<div/>').html(str).text();
    }
```

**Step 3:** Call **DecodeHtml** method and pass the value of editor as a parameter. And save return value in the variable.

```
var editorDecodeVal = DecodeHtml(editorVal).trim();
```

I hope it's informative!!!

\

\


---

Original Source: https://www.mindstick.com/forum/34438/how-to-decode-html-value-of-editor-in-mvc

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
