JSFiddle - React, Tailwind, and code Playground

by joed

HTML

<p>Type into this box and click its button.  The alert immediately appears.</p>
<div>
  <input id="rawIn" type="text" onchange="update()"/>
  <button id="rawButton" onclick="show()">Hey</button>
</div>
<p>Type into this box and click its button.  You need to click twice to get the alert.</p>
<div>
  <input id="jqIn" type="text"/>
  <button id="jqButton">Hey</button>
</div>

JavaScript

var count = 0;
function update() {
  count++;
 document.getElementById('rawButton').innerHTML = "Hey " + count;
}
function show() {
  alert('raw click');
}

$(document).ready(function() {
  var count = 0;
  $('#jqIn').on('change', function() {
      count++;
      $('#jqButton').text("Hey " + count);
  });
  $('#jqButton').click(function() { alert('jq click'); });
});