JSFiddle - React, Tailwind, and code Playground
by cmruser
JavaScript
//http://ejohn.org/apps/workshop/adv-talk/#7
//http://stackoverflow.com/questions/3397161/should-i-use-document-createdocumentfragment-or-document-createelement
var div = document.createElement('div');
var id = "test";
function getField() {
var sp = document.createElement('span');
$(sp).html('span');
return sp;
}
$(div).append(
'<label id="' + id + '">test</label>' +
'<div>' +
//$(getField()).html() +
'</div>',
getField()
);
//$('body').append(field);
var fld = '<li><label></label><div></div></li>';
var li = document.createElement("li");
$(li).append('<label>label</label><div></div>', getField());
/*
var div = document.createElement("div");
div.innerHTML = "<li><a></a></li>";
var fragment = document.createDocumentFragment();
while ( div.firstChild ) {
fragment.appendChild( div.firstChild );
}
*/
$('body').append(li);