/**
 * Jquery Multilevel Menu from JSON String
 * @autor David Ticona Saravia
 * @version 1.0
 * @abstract Create Multilevel Menu from JSON String.
 * Formats availables: Unordered list and Select (Combobox)
 * 
 */
(function ($) {
    function str_repeat(input, multiplier) {
        var y = '';
        while (true) {
            if (multiplier & 1) {
                y += input;
            }
            multiplier >>= 1;
            if (multiplier) {
                input += input;
            } else {
                break;
            }
        }
        return y;
    }
    $.fn.menuSelect = function (options) {
        var settings = $.extend({
            data: null,
            active: window.location.href,
            title: '',
            group: false,
            bullet: '- '
        }, options);
        var arrJson = settings.data;
        if (typeof settings.data === 'string') {
            try {
                arrJson = JSON.parse(settings.data);
            } catch (e) {
                return null;
            }
        }
        if (this.prop('tagName') === 'SELECT') {
            if (settings.title !== '') {
                let $opt = $('<option>').append(settings.title).val("");
                this.append($opt);
            }
            fillSelect(this, arrJson, settings.active);
            return this;
        } else {
            return null;
        }

        function fillSelect(jqContainer, arrayItem, active, level) {
            var $element = jqContainer;
            level = (typeof (level) === 'undefined') ? 0 : level;
            $.each(arrayItem, function (k, v) {
                var isParent = ((typeof (v.children) !== "undefined") && ($.isArray(v.children)));
                var $opt = $('<option>');
                if (active === v.value) {
                    $opt.addClass('active').prop('selected', true);
                }
                var bullet = (level === 0) ? '' : settings.bullet;
                if ((!settings.group) || ((level === 0) && (!isParent))) {
                    console.log(k + '::: isParent:' + isParent + ', Level:' + level + ', group:' + settings.group);
                    $opt.val(v.value).append(str_repeat('&nbsp;', level)).append(bullet + v.text);
                    $element.append($opt);
                }
                if (isParent) {
                    if ((settings.group)) {
                        createGroup($element, v.text, v.children);
                    } else {
                        fillSelect(jqContainer, v.children, active, level + 2);
                    }
                }
            });
        }
        function createGroup(jqContainer, title, items) {
            var $group = $('<optgroup>').attr('label', title);
            $.each(items, function (k, v) {
                var $opt = $('<option>');
                $opt.val(v.value).append(settings.bullet + v.text);
                $group.append($opt);
            });
            jqContainer.append($group);
        }
    };

    $.fn.menuList = function (options) {
        var settings = $.extend({
            data: null,
            active: window.location.href,
            ulParentClass: '',
            aParentClass: '',
            dropdownIcon: null
        }, options);
        var arrJson = settings.data;
        if (typeof settings.data === 'string') {
            try {
                arrJson = JSON.parse(settings.data);
            } catch (e) {
                return null;
            }
        }

        if (this.prop('tagName') === 'UL') {
            renderMenu(this, arrJson, settings.active);
            return this;
        } else {
            return null;
        }

        function renderMenu(jqContainer, arrayItem, active, depth) {
            var level = (typeof (depth) === 'undefined') ? 0 : depth;
            var $elem;
            if (level === 0) {
                $elem = jqContainer;
            } else {
                $elem = $('<ul>').addClass(settings.ulParentClass);
            }
            $.each(arrayItem, function (k, v) {
                var isParent = (typeof (v.children) !== "undefined") && ($.isArray(v.children));
                var $li = $('<li>');
                $li.attr('id', v.text);
                if (v.href === '#') {
                    v.href = 'javascript:void(0)';
                }
                var $a = $('<a>').attr('href', v.href);
                if (active === v.href) {
                    $li.addClass('active');
                }
                let $i = $('<i>').addClass(v.icon);
                $a.append($i).append("&nbsp;").append(v.text);
                if ((isParent) && (settings.dropdownIcon !== null)) {
                    $a.append('&nbsp;').append(settings.dropdownIcon);
                }
                if ((isParent) && (settings.aParentClass !== '')) {
                    $a.addClass(settings.aParentClass);
                }
                $li.append($a);
                if (isParent) {
                    $li.append(renderMenu(jqContainer, v.children, active, level + 1));
                }
                $elem.append($li);
            });
            return $elem;
        }
    };
}(jQuery));

@@ -569,24 +569,29 @@
 rn y;%0A    %7D%0A
+    %0A
     $.fn.men
@@ -613,32 +613,32 @@
 ion (options) %7B%0A
-
         var sett
@@ -794,16 +794,52 @@
 et: '- '
+,%0A            propertyValue: 'value'
 %0A       
@@ -1790,32 +1790,83 @@
  $('%3Coption%3E');%0A
+                var value = v%5Bsettings.propValue%5D;%0A
                 
@@ -1880,18 +1880,16 @@
 ive === 
-v.
 value) %7B
@@ -2121,124 +2121,8 @@
 ) %7B%0A
-                    console.log(k + '::: isParent:' + isParent + ', Level:' + level + ', group:' + settings.group);%0A
     
@@ -2138,34 +2138,32 @@
        $opt.val(
-v.
 value).append(st
@@ -2766,35 +2766,35 @@
                 
-var
+let
  $opt = $('%3Copti

Add option propertyValue to menuSelect plugin