JSFiddle - React, Tailwind, and code Playground

HTML

<div id="div1" onclick="myfun();" >

JavaScript

alert($('#div1').attr('onclick'))