JSFiddle - React, Tailwind, and code Playground
HTML
<script type="text/ecmascript">
function doSomething(id) {
var x = $("#" + id)[0];
x = x.innerHTML;
//alert(x);
var r = eval("(" + x + ")");
r.update("success");
r.method("success");
}
</script>
<script type="text/javascript" id="s">
{
update: function x(o){
alert("s-update: " + o);
}
method: function x(y){
alert("s-method: " + y);
}
}
</script>
<script type="text/javascript" id="j">
{
update: function x(o){
alert("j-update: " + o);
}
method: function x(y){
alert("j-method: " + y);
}
}
</script>
<input type="button" onclick="doSomething('s')" value="Invoke s" />
<input type="button" onclick="doSomething('j')" value="Invoke j" />