html:
<div id="container">
<select id="selector">
<option value="">--</option>
<option value="Service">Service</option>
<option value="Sales">Sales</option>
<option value="Marketing">Marketing</option>
<option value="Finance">Finance</option>
<option value="Engineering">Engineering</option>
<option value="Management">Management</option>
</select>
</div>
<input type="button" id="test" />
script without clone(),works all right:
$('#test').click(function(){
$('#container').find('select').each(function() {
var $elem = $(this);
var value = $elem.val();
alert(value);
});
});
script with clone(),not work:
$('#test').click(function(){
$('#container').clone().attr('id', 'container2').find('select').each(function() {
var $elem = $(this);
var value = $elem.val();
alert(value);
});
});