JSFiddle - React, Tailwind, and code Playground

HTML

<p id="test" onclick="alert('hi')">Click me</p>

JavaScript

$("#test")[0].onclick();