JSFiddle - React, Tailwind, and code Playground

HTML

<div id="foo">Boo!</div>

JavaScript

var ele = $( '#foo' );
alert( '1' );

var foo = function( x )
{
    var helper = ele.clone();
    alert( '2-' + x );

    var idNode = helper[0].getAttributeNode( 'id' );
    alert( '3-' + x  );
    helper[0].removeAttributeNode( idNode );
    alert( '4-' + x  );
};

foo( '1' );
foo( '2' );