PDA

View Full Version : مشکل در کپی کردن option های یه select



Hamed Beyranvand
پنج شنبه 15 آبان 1393, 08:19 صبح
سلام دوستان مشکل این کدها چیه که optionهای select رو کپی نمی کنه!!فقط اولین option رو کپی می کنه!!!

/*------------------------------------------------*/
$('.repeatable').hide();
$('.repeat').click(function() {
repeat = $(this);
$count = $(repeat).parent().find('.repeatable').length;
$copy = $(repeat).parent().find('.repeatable').first().clo ne();
/* empty value ------------------------------------------------*/
$('input', $copy).val('');
$('select', $copy).val('');
$('textarea', $copy).html('');
$('input[type="checkbox"]', $copy).prop('checked', false);
$('input[type="radio"]', $copy).prop('checked', false);

/* remane -----------------------------------------------------*/
$('input ,select,textarea', $copy).each(function() {
$name = $(this).attr('name');
$(this).attr('name', $name + '-' + $count);

$id = $(this).attr('id');
$(this).attr('id', $name + '-' + $count);
})
$('label', $copy).each(function() {
$name = $(this).attr('for');
$(this).attr('for', $name + '-' + $count);
})

$(".privacy_select_live", $copy).select2({
minimumResultsForSearch: -1,
formatResult: privacy_format,
formatSelection: privacy_format,
escapeMarkup: function(m) {
return m;
}
}).on("select2-close", function() {
$('.sel_privacy').hide();
});
$($copy).show();
$(repeat).before($copy);

});
$('.repeat').click();


ممنون میشم یکی از دوستان کمک کنه!!!

Hamed Beyranvand
پنج شنبه 15 آبان 1393, 09:58 صبح
مشکل حل نشده هنوز!!کسی از دوستان نمیتونه کمک کنه؟؟!!!!!

Hamed Beyranvand
جمعه 16 آبان 1393, 18:38 عصر
همچنان منتظر یاری سبزتان هستیم:ناراحت: