Source: Helper/jqxComboBox.js

/**
                * @author Rafael Ostertag <rafael.ostertag@math.uzh.ch>
                */


                /* global $ */

                /**
                * Qfq Namespace
                *
                * @namespace QfqNS
                */
                var QfqNS = QfqNS || {};
                /**
                * Qfq Helper Namespace
                *
                * @namespace QfqNS.Helper
                */
                QfqNS.Helper = QfqNS.Helper || {};

                (function (n) {
                'use strict';

                /**
                *
                * @function
                * @name QfqNS.Helper.jqxComboBox
                */
                var jqxComboBox = function () {
                var index;
                var $containers = $("div.jqw-combobox");

                $containers.each(function (index, object) {
                (function ($container) {
                var controlName = $container.data('control-name');
                if (!controlName) {
                QfqNS.Log.error("jqwComboBox container does not have a 'data-control-name' attribute.");
                return;
                }

                var sourceId = controlName + "_source";
                var $sourceScript = $('#' + sourceId);
                if ($sourceScript.length !== 1) {
                QfqNS.Log.error("Unable to find data for jqwComboBox using id '" + sourceId + "'");
                return;
                }

                var source = JSON.parse($sourceScript.text());


                $container.jqxComboBox({source: source});

                // Our code creates a hidden input element for each jqxwidget as sibling of the widget. We do this,
                // because jqxwidget don't create named input elements, and thus the value would not be sent to the
                // server using a Plain Old Form submission (even if performed by an ajax request).
                var $hiddenInput = $("<input>")
                .attr('type', 'hidden')
                .attr('name', controlName);

                $container.after($hiddenInput);

                $hiddenInput.val($container.jqxComboBox('val'));

                $container.on('change', function (event) {
                $hiddenInput.val(event.args.item.value);
                });
                })($(object));
                });
                };

                n.jqxComboBox = jqxComboBox;

                })(QfqNS.Helper);