Check Listbox items exist using jQuery
<p>I have 2 listboxes (Items moves between them using jquery).Suppose item1 is already selected. Then if I select item1 and item2 and item3 together, only item2 and 3 should inserted in second listbox.</p>

<p>I m not removing item from Listbox1. I need only a checking whether one of the selected items exists in the Listbox2.</p>

<pre><code>//Code
$('#btnAdd').click(function () {

    var selectedOptions = $('#&lt;%=lstAllRole.ClientID %&gt; option:selected');
    if (selectedOptions.length == 0) {
        alert("Please select option to move");
        return false;
    }

    if (selectedOptions.length == 1) {
        if ($("#&lt;%=lstSelectedRole.ClientID %&gt; option[value='" + selectedOptions.val() + "']").length &gt; 0) {
        }
        else {
            $('#&lt;%=lstSelectedRole.ClientID %&gt;').append($(selectedOptions).clone());
        }
    }
    else if (selectedOptions.length &gt; 1) {     // Selecting more than one item to move--only append items which are not in 2nd listbox

       // **I need to validate here**

    }
});
</code></pre>
