Html5 ListBox
Bind to the select event by type:jqxListBox.
Author: http://jqwidgets.com
HTML
<link rel="stylesheet" href="http://jqwidgets.com/public/jqwidgets/styles/jqx.base.css">
<link rel="stylesheet" href="http://jqwidgets.com/public/jqwidgets/styles/jqx.energyblue.css">
<script src="http://jqwidgets.com/public/jqwidgets/jqx-all.js"></script>
<div id='jqxListBox'></div>
JavaScript
var source = [
"Affogato",
"Americano",
"Bicerin",
"Breve",
"Café Bombón",
"Affogato",
"Americano",
"Bicerin",
"Breve",
"Café Bombón",
"Café au lait"];
// Create a jqxListBox
$("#jqxListBox").jqxListBox({
source: source,
theme: 'energyblue',
multiple: true
});
$('#jqxListBox').on('select', function (event) {
var args = event.args;
var items = $("#jqxListBox").jqxListBox('getSelectedItems');
if (args) {
// index represents the item's index.
var index = args.index;
var item = args.item;
// get item's label and value.
var label = item.label;
var value = item.value;
console.log("label: " + label, items);
}
});