JSFiddle - React, Tailwind, and code Playground
HTML
<div id="myElement" style="width:150px; background-color:darkgreen; color:white;" title="this works">click me</div>
<br>
<br>
<input type="button" value="Click me for same effect" onclick="dosomething($('#myElement'));" />
JavaScript
$(document).ready(function(){
function dosomething(){
alert($(this).attr('id')+' called with '+$(this).attr('title'));
}
$('#myElement').click(dosomething);
});