JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<div class="createbtn" data-idinfo="15">
Hold me down
</div>
JavaScript
function myFunction(){
alert($(this).attr('class'));
alert($(this).attr('data-idinfo'));
alert('held it');
}
var timeoutId = 0;
$('.createbtn').on('mousedown', function() {
timeoutId = setTimeout(myFunction, 1000);
}).on('mouseup mouseleave', function() {
clearTimeout(timeoutId);
});