JSFiddle - React, Tailwind, and code Playground
HTML
<div>
<button>
Click Me! Click Me!
</button>
<p>
Hello
</p>
</div>
JavaScript
var Person = function(first, last, secret) {
this.first = first;
this.last = last;
this.secret = secret;
}
var guy = new Person("Bruce", "Wayne", "Batman");
var click = function($element, person) {
$element.closest('div').find('p').text(person.first + " " + person.last + " is " + person.secret);
};
$("div").on('click', 'button', function() {
click($(this), guy);
});