D
D
dsx902017-09-23 18:01:25
Yii
dsx90, 2017-09-23 18:01:25

How to remove the selected value in the DropSownList on the next line. With the addition of MultipleInput?

The task is to remove the selected value in the next line of the DropDownList.
There is already a script that does this, but it also removes the very first value. That is, there are 2 values
​​First
Second
Third
When the page is loaded, the first one is already removed. (this needs to be fixed somehow)
I choose the second and only the third remains in the next line.

$('.multiple-input').on('afterAddRow', function(e, row) {
        console.log('calls on after add row event', $(row));
            var selected = [];
            $('.multiple-select').each(function(index, ele) {
                var val = $(ele).val();
                if (val) {
                    selected.push(val);
                }
            })
            
            $(row).find('.multiple-select').first().find('option').each(function(i, ele) {
                if (selected.indexOf($(ele).attr('value')) !== -1) {
                    $(ele).remove();
                }
            })
        })

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question