JSFiddle - React, Tailwind, and code Playground

HTML

<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css">
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<label for="autocomplete">Select a programming language: </label>
<input id="autocomplete">

JavaScript

var arr = ["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby"]
$("#autocomplete").autocomplete({
  source: arr,
  close: function() {
    var val = $('input#autocomplete').val()
    if ($.inArray(val, arr) > -1) {
      $('body').append(val);
    }


  }
});