JSFiddle - React, Tailwind, and code Playground
by rhodee
HTML
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<style type="text/css" media="all">
body {height: 100%}
#square {width: 50px; height: 50px; background-color: red;}
</style>
<title>Home</title>
<body>
<div id="square">
</div>
</body>
</head>
</html>
JavaScript
<script type="text/javascript">
var counter = function () {
//private variables inaccessbile outside this scope.
var elt = document.getElementById("square"),
clickCount = 0;
// call a priviledged method with access to prviate vars from
// outer scope
var count = function () {
clickCount += 1;
alert("you clicked me " + clickCount + " times!");
};
}
elt.addEventListener("click", counter, false);
</script>