JSFiddle - React, Tailwind, and code Playground
HTML
<button type="button" id="button1">Click Me!</button>
<button type="button" id="button2">Click Me!</button>
JavaScript
function execute (Args){
var _args = Args; // note the var to make _args local
var newstuff;
$(function() {
if (_args[0] === '#button1') {
newstuff = "Oh yeah, that was button 1";
}
if (_args[0] === '#button2') {
newstuff = "Twolicious! ";
}
$(_args[0]).click(function() {
alert("hello " + newstuff + _args[0]);
return false;
});
});
}
execute(['#button1']);
execute(['#button2']);