Search code examples
jqueryhtml-encodejquery-cookie

Jquery HtmlEncode data to cookie


I am using the jQuery cookieplugin, and want to save the values from a CKEditor into a cookie, to be able to make a draftfunction, a bit similar to the one on StackOverflow.

The CKEditors content can contain html, so is there a way to htmlencode the HTML-data with jQuery, so it can be passed to a cookie?


Solution

  • Use encodeURIComponent() and decodeURIComponent()