After appending a select option and selecting the appended option alert shows undefined + Jquery
<p>I am a newbie with Jquery and i am trying to append an select option. This works and when i select the newly added option in the select. I am getting undefined in alert.</p>

<pre><code>var selects = $(this).closest('div').find('.accSelectandlookup') ;

//Check if the accid is already present in the selectoptions and if not then add  

if (!selects.find('option[value="' + accid + '"]').length) {
alert(accid); // This throws up the correct value
selects.append('&lt;option value="' + accid + '"&gt;Attach to Existing : ' + accname + '&lt;/option&gt;');
}
</code></pre>

<p>What am i doing wrong ?</p>

<p>Thanks in advance</p>

<pre><code>selects.change(function(){

alert('selected value is ' +  selects.filter(":selected").val()); // This throws undefined
})
</code></pre>
