Показать сообщение отдельно
  #4 (permalink)  
Старый 14.04.2015, 18:44
Аватар для рони
Профессор
Отправить личное сообщение для рони Посмотреть профиль Найти все сообщения от рони
 
Регистрация: 27.05.2010
Сообщений: 33,072

Смена всех id у клона
SKLNSK,
<!DOCTYPE HTML>

<html>

<head>
  <title>Untitled</title>
  <meta charset="utf-8">
  <style type="text/css">
  </style>
  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
  <script>
     $.fn.idPlus = function () {
       $('*',this).add(this).each(function (index, self) {
        self.id && (self.id += Math.floor((Math.random()*1000)))
    })
    return this
}

     $(function(){
      var id_copy = 'first', id_last = 'last';
      $("#"+id_copy).clone().idPlus().appendTo("#"+id_last);
     alert($("#"+id_last).html())
});


  </script>
</head>

<body>
<div id='first'>
<span id='info'>Информация</span>
<div id='main'>
<span id='show'>текст1<b>test</b></span>
</div>
</div>
<div id='last'>

</div>
Ответить с цитированием