Reputation: 1004
i am working on functionality where there are two multiselectlists 1) select1 2) select2 user can select option from select1 and can be added in to the second2
$('#add').click(function () {
return !$('#select1 option:selected').remove().appendTo('#select2');
});
$('#remove').click(function () {
return !$('#select2 option:selected').remove().appendTo('#select1');
});
I am using quicksearch jquery plugin to provide searching facility on select1
$('input#searchFields').quicksearch('#select1 option');
Problem is if select2 has any options which are selected from select1 and any search is applied on select1, same search is applied on options of select2 also which is not expected.
i think this is happening as all options in select2 is taken from select1 and quicksearch use some internal marking on options in select1 for searching purpose and when these options are added into select2, they are also considered for searching.
Please advice.
Upvotes: 0
Views: 319
Reputation: 1004
Used following jquery code to fix the problem.
$('#add').click(function () {
$('#select1 option:selected').each(function () {
var option = $('<option/>');
option.attr({ 'value':$(this).val() }).text($(this).text());
$('#select2').append(option);
});
});
so i think quicksearch marking options for searching is the actual case here.
Upvotes: 0