JSFiddle - React, Tailwind, and code Playground
by NunoMira
HTML
<label>Tag friends: </label>
<form>
<div id="friends" class="ui-helper-clearfix">
<input type="text" name="to" id="to" value="" />
</div>
</form>
JavaScript
//exemplo do autocomplete (select + change)
$( "#to" ).autocomplete(
{
source: function( request, response)
{
var friendsArray = [];
friendsArray = [{"id": 1, "name": "bob", "value":"bob"},
{"id":2, "name":"mary", "value":"mary"},
{"id":3, "name":"matt", "value":"matt"}];
response(friendsArray);
return;
},
select: function(e, ui)
{
alert("selected!");
},
change: function(e, ui)
{
alert("changed!");
}
});