

jQuery(document).ready(function ($) {
    function formatText(icon) {
        return $(`<span><span class="${icon.text}"></span> ${icon.text}</span>`);
    }
    $('[id^="edit-menu-item-icon-"]').select2({
        templateSelection: formatText,
        templateResult: formatText
    });
});