JSFiddle - React, Tailwind, and code Playground

HTML

<script src="http://code.jquery.com/ui/1.11.1/jquery-ui.min.js"></script>
<input type="text" name="state" id="state" placeholder="state" required="" onkeypress="return nospecialCharacters(event)" class="ui-autocomplete-input error" autocomplete="off">

JavaScript

function nospecialCharacters(thi, dec) {
  if (window.event) keycode = window.event.keyCode;
  else if (e) keycode = e.which;
  else return true;
  if (((keycode >= 65) && (keycode <= 90)) || ((keycode >= 48) && (keycode <= 57)) || ((keycode >= 97) && (keycode <= 122)) || keycode == 32 || keycode == 45 || keycode == 47 || keycode == 92 || keycode == 44) {
    return true;
  } else {
    return false;
  }
}




$("#state").on("keydown", function(event) {
    var statevalue = $("#state").val();
    if (statevalue) {
      $.ajax({
        type: 'GET',
        url: url + '/HHH/JUI/chdautosuggestatemodified?state=' + statevalue,
        jsonpCallback: 'jsonCallback',
        cache: true,
        dataType: 'jsonp',
        jsonp: false,
        success: function(respons) {
          $("#state").autocomplete({
             noResults : '',
            source: respons,
            minLength: 2
          });
        },
        error: function(e) {}
      });
    } else {
      //prevents();
      event.stopPropagation();
      //      event.preventDefault();
      event.stopImmediatePropagation();
    }
  });