JSFiddle - React, Tailwind, and code Playground

by Luke Marlow

HTML

<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
<ul id='commentList'>
</ul>
<form>
  <input type='text' id='comment'/>
  <input type='button' id='postComment' value='Post'/>
</form>https://jsfiddle.net/MrMarlow/8xqj31nv/

JavaScript

$("#comment").val("test");

setTimeout(setup(), 100);

function setup() {
  $('#postComment').click(function(e) {
    e.preventDefault();

    var comment = $('#comment').val();

    if (comment.length) {
      $('#commentList').append('<li>' + comment + '</li>');
      $('#comment').val('');
    }
  });
}