Hi,
I want to decode editor value in jquery. Please give me some idea to achieve this task.
The code 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);
}
}
});
Hemant Patel
16-Mar-2018Hi Clara,
I analyzed your code. You can easily decode your editor value 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.
I hope it's informative!!!