JSFiddle - React, Tailwind, and code Playground
HTML
<ul>
<li>
Click here: <a href="#">$(":first.not(.foo)")</a>
</li>
<li>
Then here: <a href="#">$(':first')</a>
</li>
</ul>
<p> Log: </p>
JavaScript
$(function() {
$("a").click(function() {
//Run the code in the anchor text
var exp = $(this).text();
eval(exp);
var p = $("<p>");
//report success
p.text("Code ran successfully: " + exp);
$("body").append(p);
return false;
});
window.onerror = function(e) {
//report any errors
var p = $("<p>");
p.addClass('error');
p.text(e);
$("body").append(p);
};
});