JSFiddle - React, Tailwind, and code Playground

by shapeshifta

HTML

<div id="container1"></div>
<div id="container2"></div>
<div id="source" class="source">
    <form action="/get/this/going/">
        <input />
        <input />
    </form>
</div>

CSS

form{background:#f00;padding:10px;margin-bottom:10px}
.source form{background:#00f}

JavaScript

var testCase = testCase || {};
testCase.sourceForm = $('#source form');
testCase.working = function(){
    /* funktioniert in ie8, oder 
    bei Neuerstellung document.createElement('form') oder 
    document.getElementById("testForm").cloneNode(true)
    */
    var clone = testCase.sourceForm.clone();
    
    clone.appendTo('#container1');
};
testCase.notWorking = function(){
    /* funktioniert nicht in ie8,
    analog mit innerHTML
    */
    var formHtml = testCase.sourceForm.parent().html();
    
    $('#container2').html(formHtml);
};
testCase.init = (function(){
    $('div')
        .click(function(){
            alert(this.innerHTML);
        });

    testCase.working();
    testCase.notWorking();
})();