How to render HTML as visualized HTML in jQuery.tmpl ()?

I cannot properly assign HTML using jQuery.tmpl (). If I pass the value of something as an html tag, it is displayed as since it is instead of the HTML tags displayed on the page

<div id="window"> <script id="lines" type="text/x-jquery-tmpl"> <div id="${id}" class="line ${type}"><span>${name}</span>: ${body}</div> </script> </div> var line = { name: 'John', body: '<strong>hello</strong> }; $('#lines').tmpl(line).appendTo('#window'); 
+6
source share
1 answer

You can wrap the template variable {{html body}} to override the default encoding behavior.

+17
source

Source: https://habr.com/ru/post/889848/


All Articles