Select2 Appear Like Text Input Example
Using the select2 plugin to only display as a text input rather than a dropdown.
by Daniel Echeverria
HTML
<link rel="stylesheet" href="//cdn.jsdelivr.net/select2/3.4.8/select2.css">
<script src="//cdn.jsdelivr.net/select2/3.4.8/select2.js"></script>
<h3>Select2 Appear Like Text Input Example</h3>
<input type="text" id="placeSelect"/>
JavaScript
$('#placeSelect').select2({
width: '100%',
allowClear: true,
multiple: true,
maximumSelectionSize: 1,
placeholder: "Click here and start typing to search.",
data: [
{ id: 1, text: "Ford" },
{ id: 2, text: "Dodge" },
{ id: 3, text: "Mercedes" },
{ id: 4, text: "Jaguar" }
]
});