Untitled

mail@pastecode.io avatar
unknown
plain_text
8 months ago
754 B
3
Indexable
Never
const modalImIwish = (function () {
    function _init(fieldImValue) {
        $('#field-im').change(function(){
            const arr = [];
            fieldImValue = $(this).val();
            if (fieldImValue !== '') {
                $('#field-iwish')
                    .find('option')
                    .remove()
                    .end()
                    .append('<option value="" selected>' + $('#field-iwish').data('label') + '</option>');
                $('#data-i-wish optgroup[label="'+fieldImValue+'"] option').each(function () {
                    arr.push($(this));
                });
                $('#field-iwish').append(arr);
            }
        });
    }

    return { init: _init };
})();

export default modalImIwish;