JSFiddle - React, Tailwind, and code Playground

by Emre Erkan

HTML

<input type="text" class="newTag" />
<input type="button" class="addTag" value="Add" />
<div class="pendingTags"></div>

JavaScript

$('.addTag').live('click', function () {
    var pending = $('.pendingTags').html();
    var newTag = $('.newTag').val();
    if((', ' + pending).indexOf(', ' + newTag + ', ') < 0) {
        $('.pendingTags').html(pending + newTag + ', ');
    }
});