JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
<div class="big">
</div>
<input type='text' value='Some text!'>
CSS
.big {
width: 100px;
height: 100px;
background: red;
}
.big:hover {
background: blue;
}
JavaScript
$('.big').hover(function () {
// will not work, no user action
$('input').select();
document.execCommand('copy');
});
$('.big').mousedown(function () {
//works
document.execCommand('copy');
});