JSFiddle - React, Tailwind, and code Playground
by John Doe
HTML
<div id="button" class="copy-this">
<button class="btn">gomb</button>
</div>
<div data-copyid="button" class="copy-here">
</div>
<div id="lidnk" class="copy-this">
<a href="">asd</a>
</div>
<div data-copyid="link" class="copy-here">
</div>
JavaScript
$('.copy-here').each(function(){
if( $(this)[0].hasAttribute('data-copyid') ){
var copyId = $(this).attr('data-copyid');
alert('copyid:' + copyId);
if($('.copy-this#'+copyId).length){
$(this).html('<pre><code>'+ $('.copy-this#'+copyId).html() +'</pre></code>');
}
}
});