There's a standard HTML element for adding auto-complete to a text field: datalist
.
You use it like this:
<label>
<input type="text" list="colors" />
</label>
<datalist id="colors">
<option value="red">
<option value="blue">
<option value="green">
</datalist>
<input type="text" list="colors" />
</label>
<datalist id="colors">
<option value="red">
<option value="blue">
<option value="green">
</datalist>
Try it:
Final thoughts
Good luck styling it, though. Also, screen reader support is apparently lacking.