Html5 ListBox
Invoke the getItems method of the jqxListBox. Author: http://jqwidgets.com
by jqwidgets
HTML
<link rel="stylesheet" href="https://jqwidgets.com/public/jqwidgets/styles/jqx.base.css">
<script src="https://jqwidgets.com/public/jqwidgets/jqx-all.js"></script>
<link rel="stylesheet" href="https://jqwidgets.com/public/jqwidgets/styles/jqx.energyblue.css">
<div id='jqxListBox'></div>
<div>
<input style="margin-top: 20px;" type="button" id='jqxButton' value="Show the items" />
</div>
<div id="log"></div>
JavaScript
var source = [
"Affogato",
"Americano",
"Bicerin",
"Breve",
"Café Bombón",
"Café au lait",
"Caffé Corretto",
"Café Crema",
"Affogato",
"Americano",
"Bicerin",
"Breve",
"Café Bombón",
"Café au lait",
"Caffé Corretto",
"Café Crema",
"Caffé Latte"];
// Create a jqxListBox
$("#jqxListBox").jqxListBox({
source: source,
theme: 'energyblue',
width: '200px',
height: '250px'
});
$("#jqxButton").jqxButton({
theme: 'energyblue'
});
var items = $("#jqxListBox").jqxListBox('getItems');
$('#jqxButton').on('click', function () {
var log = "";
for (var i = 0; i < items.length; i++) {
log += items[i].label;
if (i < items.length - 1) log += ', ';
}
$("#log").text(log);
});