JSFiddle - React, Tailwind, and code Playground
by william
HTML
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/themes/cupertino/jquery-ui.css">
<input id="tags"/>
JavaScript
var availableTags = {
"responseHeader": {
"status": 0,
"QTime": 1,
"params": {
"fl": "title,count",
"sort": "count desc",
"indent": "on",
"start": "0",
"q": "\"b\" AND count:[3 TO *]",
"wt": "json",
"rows": "5",
"version": "2.2"
}
},
"response": {
"numFound": 6536,
"start": 0,
"docs": [
{
"title": "blood",
"count": 19890},
{
"title": "biochemistry",
"count": 14480},
{
"title": "biochemical and biophysical research communications",
"count": 6976},
{
"title": "businessweek",
"count": 6498},
{
"title": "biochimica et biophysica acta",
"count": 6226}]
}
};
var tags = [];
for (var i = 0; i < availableTags.response.docs.length; i++) {
var trm = availableTags.response.docs[i];
tags[i] = trm.title;
}
$("#tags").autocomplete({
source: tags
});