jquery element duplication in list box
<p>I have 5 list boxes with the same name. If i choose  the same element in the list box it returns the error message as this value already selected. How to implement this in javascript Or in jquery</p>

<pre><code>                &lt;table width="50%" border="0"&gt;
            &lt;tr&gt;
            &lt;td&gt;&lt;select id="prev" name="prev[0][]" &gt;
            &lt;option value="test"&gt;test&lt;/option&gt;
            &lt;option value="test1"&gt;test&lt;/option&gt;
            &lt;option value="test2"&gt;test&lt;/option&gt;
            &lt;option value="test3"&gt;test&lt;/option&gt;
            &lt;option value="test4"&gt;test&lt;/option&gt;

            &lt;/select&gt;
            &lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
            &lt;td&gt;&lt;select id="prev" name="prev[0][]" &gt;
            &lt;option value="test"&gt;test&lt;/option&gt;
            &lt;option value="test1"&gt;test&lt;/option&gt;
            &lt;option value="test2"&gt;test&lt;/option&gt;
            &lt;option value="test3"&gt;test&lt;/option&gt;
            &lt;option value="test4"&gt;test&lt;/option&gt;

            &lt;/select&gt;
            &lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
            &lt;td&gt;&lt;select id="prev" name="prev[0][]" &gt;
            &lt;option value="test"&gt;test&lt;/option&gt;
            &lt;option value="test1"&gt;test&lt;/option&gt;
            &lt;option value="test2"&gt;test&lt;/option&gt;
            &lt;option value="test3"&gt;test&lt;/option&gt;
            &lt;option value="test4"&gt;test&lt;/option&gt;

            &lt;/select&gt;
            &lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
            &lt;td&gt;&lt;select id="prev" name="prev[0][]" &gt;
            &lt;option value="test"&gt;test&lt;/option&gt;
            &lt;option value="test1"&gt;test&lt;/option&gt;
            &lt;option value="test2"&gt;test&lt;/option&gt;
            &lt;option value="test3"&gt;test&lt;/option&gt;
            &lt;option value="test4"&gt;test&lt;/option&gt;

            &lt;/select&gt;
            &lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
            &lt;td&gt;&lt;select id="prev" name="prev[0][]" &gt;
            &lt;option value="test"&gt;test&lt;/option&gt;
            &lt;option value="test1"&gt;test&lt;/option&gt;
            &lt;option value="test2"&gt;test&lt;/option&gt;
            &lt;option value="test3"&gt;test&lt;/option&gt;
            &lt;option value="test4"&gt;test&lt;/option&gt;

            &lt;/select&gt;
            &lt;/td&gt;
            &lt;/tr&gt;
            &lt;/table&gt;
</code></pre>

<p>The Query Function i used to check the listbox is selected or not is :</p>

<pre><code>$("select[name^='prev["+k+"']").each(function( i ) {
        lsval = this.value;

        if(lsval == '') {
                alert("enter value");
                $("select[name^='prev["+k+"']").eq(i).focus();
                return false;
        }

    });
</code></pre>

<p>I have the options as (test,test1,test2,test3,test4)
If i choose the same value in more than 1 list box then it returns the alert message as ('This value already selected').</p>

<p>How to implement this. please do the needful. Thanks</p>
