We have MVC an application. we want to offer our customers to enter html texts for use in document generation. For this purpose we have included CK Editor. CK has a function to return the html. We want to 'encode' this Html, so we can place it in an input field that will be included in a form post.
What JavaScript function(s) can we use to convert the Html string to a format that we can send with the formpost. The form post is done via AJAX.
Update: In an other post we found this function:
function htmlEscape(str) {
return String(str)
.replace(/&/g, '&')
.replace(/"/g, '"')
.replace(/'/g, ''')
.replace(/</g, '<')
.replace(/>/g, '>');
}
It looks like this will do the trick, but are there any build-in or JQuery functions that will do this?