SO - 29382244
by Arun P Johny
HTML
<input type="text" placeholder="Type 1, 2, or 3 here." autocomplete="off" />
<div id="d1">
<ul></ul>
</div>
<div id="d2">
<ul></ul>
</div>
<div id="d2">
<ul></ul>
</div>
JavaScript
$('input').change(function () {
var value = this.value;
if ($.inArray(value, ['1', '2', '3']) > -1) {
$('<li />', {
text: value
}).appendTo('#d' + value + ' ul')
}
})