jquery で選択ボックスを動的に作成しようとしていますが、現在の値を持つべきではありません
jQuery('.copyad').each(function() { ads.push(jQuery(this).attr('id')); }); // ["ad1","ad2","ad3"]
jQuery.each(ads , function(index, value) {
option += '<option value="'+value+'">Copy To Ad '+value+'</option>';
});
jQuery('.copyad').html(option);
次のような出力が得られます
Ad1 ===
<select class="copyad" id="ad1" >
<option value="ad1">Copy To ad1 </option>
<option value="ad2">Copy To ad2 </option>
<option value="ad3">Copy To ad3 </option>
</select>
Ad2 ===
<select class="copyad" id="ad2" >
<option value="ad1">Copy To ad1 </option>
<option value="ad2">Copy To ad2 </option>
<option value="ad3">Copy To ad3 </option>
</select>
Ad3 ===
<select class="copyad" id="ad3" >
<option value="ad1">Copy To ad1 </option>
<option value="ad2">Copy To ad2 </option>
<option value="ad3">Copy To ad3 </option>
</select>
しかし、私は次のような出力が必要です
Ad1 ===
<select class="copyad" id="ad1" >
<option value="ad2">Copy To Ad 2 </option>
<option value="ad3">Copy To Ad 3 </option>
</select>
Ad2 ===
<select class="copyad" id="ad2" >
<option value="ad1">Copy To Ad 1 </option>
<option value="ad3">Copy To Ad 3 </option>
</select>
Ad3 ===
<select class="copyad" id="ad3" >
<option value="ad1">Copy To Ad 1 </option>
<option value="ad2">Copy To Ad 2 </option>
</select>
後で ...
これどうやってするの