title: Jquery Clone() modify clone after or before insert
body: <p><strong>Environment</strong></p>
  
  <ul>
  <li>Jquery -> function clone();</li>
  <li><a href="http://api.jqueryui.com/draggable/#event-stop" rel="nofollow">Jquery Ui draggable</a></li>
  <li>with $(this) we are on the div BOX level we could also use the <a href="http://api.jqueryui.com/draggable/#event-stop" rel="nofollow">ui or events object</a></li>
  </ul>
  
  <p><strong>What i want</strong></p>
  
  <p>Copy the box but delete the class "hure" from the copied child</p>
  
  <p><strong>Structure of the box to be cloned</strong></p>
  
  <pre><code>&lt;div name="box"&gt;
      &lt;a .../&gt;
      &lt;span..../&gt;
      &lt;span..../&gt;
      &lt;div class="eye"&gt; &lt;img class="hure"..../&gt;&lt;/div&gt;
  ...
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>2Consider</strong></p>
  
  <ul>
  <li>I use a general function for the drag and clone, so only in 10% of the cases there will be a img tag in it and the class "hure" can be found, in the others there are other input fields.</li>
  <li>the cloned elements are in the dom structure AFTER the original (maybe important for searching).</li>
  </ul>
  
  <p><strong>My approach:</strong></p>
  
  <p>Resulting that both class get removed, whytf not only the clone?</p>
  
  <pre><code>helper : function(ev,el) { 
          if ($(this).find(".hure").length &gt; 0){
          return($(el).find(".hure").removeClass("hure").clone());}
          else 
          {
          return($(this).clone());}
          },
  </code></pre>
  
  <p>Thanks for any help, i am lost since hours trying to do that thing. I can't find code to differ the original from the ***g clone.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>An alternative way would be to do that AFTER the clone, i already tried that without success.</p>
  
  <p><strong>my successless approach</strong></p>
  
  <pre><code>if ($(this).find(".hure").length &gt; 0){ $(this).find(".hure").eq(1).removeClass("hure");}
  </code></pre>
  
  <p><strong>Solution</strong></p>
  
  <pre><code>stop: function() {
          if ($(".hure").length&gt;0){
          $(".hure:eq(1)").removeClass("hure");}
          }
  </code></pre>