0

I have stored some html contents into a div for later processing.

When I retrieve the contents back (using $(".MyDiv").html()) & display it else-where in the page, contents are html encoded.

I tried using jQuery.parseHTML() method to decode this string, but it didn't work.

EDIT: I was using jQuery template to store the data in div, which by default encoded the string, I had to suppress encoding behavior. using following template, while binding.

{{html Response}}
Abhijeet
  • 13,562
  • 26
  • 94
  • 175

1 Answers1

0

Here's a quick example. You just pass it into the other jQuery object's html function.

JSFiddle

HTML:

<div id="someInfo">Hello, this is a simple example.<p>Boom, a paragraph.</p></div>

<div id="storeHereLater"></div>

CSS:

$(function(){
   var someInfoHTML = $('#someInfo').html();

    $('#storeHereLater').html(someInfoHTML);
});
Eric Hotinger
  • 8,957
  • 5
  • 36
  • 43