1/**
2 * Convert a template string into HTML DOM nodes
3 * @param {String} str The template string
4 * @return {Node} The template HTML
5 */
6var stringToHTML = function (str) {
7 var parser = new DOMParser();
8 var doc = parser.parseFromString(str, 'text/html');
9 return doc.body;
10};
11
1 <div style="border:1px solid black; margin-top:20px; height:500px; overflow:scroll;" id="messageBox" >
2 <div class="row " style="border: 1px solid black; margin:10px; ">
3 <p style="float: left;">User Name : </p> <p style="margin-left:2px; float: left;"> Message content</p>
4 </div>
5 </div>