Html ListBox

Invoke the getCheckedItems method of the jqxListBox. Author: http://jqwidgets.com

by Manu Vashishtha

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>
<div>
  <input style="margin-top: 20px;" type="button" id='jqxButton' value="Show the items" />
</div>

JavaScript

var source = [
     "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',
     checkboxes: true
   });
   $("#jqxButton").jqxButton({
     theme: 'energyblue'
   });
   var items = $("#jqxListBox").jqxListBox('getItems');
   $('#jqxButton').on('click', function() {
     var checkedItems = "";
     var items = $("#jqxListBox").jqxListBox('getCheckedItems');
     $.each(items, function(index) {
       checkedItems += this.label + ", ";
     });
     alert(checkedItems);
   });