div.innerHTMl object object code example
Example 1: how to innerhtml is empty
element.innerHTML.length == 0 ? element.appendChild(createdEl) : (element.innerHTML = '', modalNote.appendChild(createdEl));
Example 2: javascript create node from innerhtml
function createElement( str ) {
var frag = document.createDocumentFragment();
var elem = document.createElement('div');
elem.innerHTML = str;
while (elem.childNodes[0]) {
frag.appendChild(elem.childNodes[0]);
}
return frag;
}