JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script>
<link rel="stylesheet" href="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.21/themes/black-tie/jquery-ui.css">
<input type="text" class="name" />
<input type="text" class="value" />
JavaScript
var src = [{
"label": "Jack",
"value": "1"
}, {
"label": "back",
"value": "2"
}, {
"label": "tera",
"value": "3"
}, {
"label": "judo",
"value": "4"
}];
$('.name').change(function() {
$('.value').val(0);
});
$(".name").autocomplete({
source: src,
select: function (event, ui) {
event.preventDefault();
this.value = ui.item.label;
$('.value').val(ui.item.value);
}
});