JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://code.jquery.com/ui/1.11.4/jquery-ui.min.js"></script>
<link rel="stylesheet" href="https://code.jquery.com/ui/1.11.4/themes/pepper-grinder/jquery-ui.css">
<div id="copy_dialog">
<table>
<tbody>
<tr>
<th>Title:</th>
<td><input type="text" class="title" name="title"></td>
</tr>
<tr>
<th>Number:</th>
<td><input type="text" name="number"></td>
</tr>
</tbody>
</table>
</div>
JavaScript
var autoComplete,
dlg = $("#copy_dialog"),
input = $(".title", dlg),
data = [
"ActionScript",
"AppleScript",
"Asp",
"BASIC",
"C",
"C++",
"Clojure",
"COBOL",
"ColdFusion",
"Erlang",
"Fortran",
"Groovy",
"Haskell",
"Java",
"JavaScript",
"Lisp",
"Perl",
"PHP",
"Python",
"Ruby",
"Scala",
"Scheme"
];
// initialize autocomplete
input.autocomplete({
source: data,
open: function () {
autoComplete.zIndex(dlg.zIndex()+1);
}
});
// get reference to autocomplete element
autoComplete = input.autocomplete("widget");
// init the dialog containing the input field
dlg.dialog({
autoOpen: true,
width: 500,
modal: false,
title: 'Duplicate',
buttons: {
'Cancel': function()
{
$(this).dialog('close');
},
'Save': function()
{
$(this).dialog('close');
}
}
});
// move the autocomplete element after the dialog in the DOM
autoComplete.insertAfter(dlg.parent());