JSFiddle - React, Tailwind, and code Playground
HTML
<button class="btn btn-default active" id="rakesh" data-placement="top" data-toggle="tooltip" data-source="Some title">XYZ </button>
JavaScript
$('.active').click(function(){
//alert('click');
/* Get the text field */
var copyText = document.getElementsByClassName("active");
/* Select the text field */
copyText.select();
/* Copy the text inside the text field */
document.execCommand("copy");
/* Alert the copied text */
//alert("Copied the text: " + copyText.data('source'));
});