JavaScript ComboBox

Set the multiSelect property of the jqxComboBox. Author: http://jqwidgets.com

by mark edwards

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='jqxComboBox'></div>

JavaScript

var source = [
        "Affogato",
        "Americano",
        "Bicerin",
        "Breve",
        "Café Bombón",
        "Café au lait",
        "Caffé Corretto",
        "Café Crema",
        "Caffé Latte"
      ];
      // Create a jqxComboBox
      $("#jqxComboBox").jqxComboBox({
        source: source,
        width: '250px',
        height: '25px',
        multiSelect: true,
        theme: 'energyblue',
        openDelay: 0
      });

      //var isItemSelected = false;
      var closeArrow = $('#dropdownlistArrowjqxComboBox');

      closeArrow.on('click', function() {
        //if (isItemSelected) {
        if ( $('#jqxComboBox').jqxComboBox('isOpened') )  { 
          //isItemSelected = false;
          console.log('item is opened, closing!');
          $("#jqxComboBox").jqxComboBox("close");
        }
      });

      $('#jqxComboBox').on('change', function(event) {
        isItemSelected = true;
      });

      $('#jqxComboBox').on('close', function(event) {
        if (isItemSelected) {
          $("#jqxComboBox").jqxComboBox('open');
        } 
      });