JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://www.emposha.com/demo/fcbkcomplete_2/jquery.fcbkcomplete.js"></script>
<select id="select3" name="select3">
<option id="2">Canon Powershot</option>
<option id="3">Fastrack Bag</option>
<option id="4">Iphone 4</option>
<option id="5">Levis Jeans</option>
</select>
<input type="text" id="interest" name="interest" />
<input type="text" id="productPrice" name="productPrice" />
CSS
/* Copyright: Guillermo Rauch <http://devthought.com/> - Distributed under MIT - Keep this message! */
/* TextboxList sample CSS */
ul.holder { margin: 0; border: 1px solid #999; overflow: hidden; height: auto !important; height: 1%; padding: 4px 5px 0; }
*:first-child+html ul.holder { padding-bottom: 2px; } * html ul.holder { padding-bottom: 2px; } /* ie7 and below */
ul.holder li { float: left; list-style-type: none; margin: 0 5px 4px 0; white-space:nowrap;}
ul.holder li.bit-box, ul.holder li.bit-input input { font: 11px "Lucida Grande", "Verdana"; }
ul.holder li.bit-box { -moz-border-radius: 6px; -webkit-border-radius: 6px; border-radius: 6px; border: 1px solid #CAD8F3; background: #DEE7F8; padding: 1px 5px 2px; }
ul.holder li.bit-box-focus { border-color: #598BEC; background: #598BEC; color: #fff; }
ul.holder li.bit-input input { width: auto; overflow:visible; margin: 0; border: 0px; outline: 0; padding: 3px 0px 2px; } /* no left/right padding here please */
ul.holder li.bit-input input.smallinput { width: 20px; }
/* Facebook demo CSS */
ul.holder { margin: 0 !important }
ul.holder li.bit-box, #apple-list ul.holder li.bit-box { padding-right: 15px; position: relative; z-index:1000;}
#apple-list ul.holder li.bit-input { margin: 0; }
#apple-list ul.holder li.bit-input input.smallinput { width: 5px; }
ul.holder li.bit-hover { background: #BBCEF1; border: 1px solid #6D95E0; }
ul.holder li.bit-box-focus { border-color: #598BEC; background: #598BEC; color: #fff; }
ul.holder li.bit-box a.closebutton { position: absolute; right: 4px; top: 5px; display: block; width: 7px; height: 7px; font-size: 1px; background: url('close.gif'); }
ul.holder li.bit-box a.closebutton:hover { background-position: 7px; }
ul.holder li.bit-box-focus a.closebutton, ul.holder li.bit-box-focus a.closebutton:hover { background-position: bottom; }
/* Autocompleter */
.facebook-auto { display: none; position: absolute; background: #eee; z-index:1001;}
.facebook-auto .select_all_items...
JavaScript
//Internal Javascript to execute on dom ready
$(document).ready(function() {
$("#select3").fcbkcomplete({
addontab: true,
maxitems: 10,
input_min_size: 0,
height: 10,
select_all_text: "select",
onselect: clicker,
});
});
var clicker = function() {
var selected = new Array();
$("option",this).each(function() {
selected.push($(this).val());
});
$('#interest').val(selected.join(', '));
//alert(selected.join(', '));
/*var itemsobj = document.getElementsByName("select3[]");
str = '';
alert('test');
count = 0;
var arr = new Array();
for (var i = 0; i < itemsobj.length; i++) {
count += 1;
str += itemsobj[i].value + ',';
alert(str);
arr[i] = itemsobj[i].value;
}
var length = str.length;
var strr = str.substring(0, length - 1);
document.getElementById('interest').value = strr;*/
};