JSFiddle - React, Tailwind, and code Playground
HTML
<div class="wrapper">
<button class="copy">Copy</button>
<div id="copy">Text to be copied </div>
</div>
JavaScript
$(function() {
var copy = new Clipboard('.copy', {
target: function(trigger,next) {
console.log(trigger,next);
return trigger.nextElementSibling;
}
});
});