<p dir="auto">I think I wrote correctly but it doesn't work like I thought :(<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://cloud.githubusercontent.com/assets/13378727/10334974/3089e878-6d18-11e5-8f89-d9420cb51a43.jpg"><img src="https://cloud.githubusercontent.com/assets/13378727/10334974/3089e878-6d18-11e5-8f89-d9420cb51a43.jpg" alt="30" style="max-width: 100%;"></a></p>
<p dir="auto">The following link is running its jQuery twice: <a href="http://www.freecodecamp.com/challenges/target-the-parent-of-an-element-using-jquery" rel="nofollow">http://www.freecodecamp.com/challenges/target-the-parent-of-an-element-using-jquery</a></p>
<h4 dir="auto">Issue Description</h4>
<ul dir="auto">
<li>It happens when I load it first time. Looking at my screenshot you can notice that there are 3 target5</li>
<li>For reproduction of this bug you just need open this link</li>
</ul>
<h4 dir="auto">Browser Information</h4>
<ul dir="auto">
<li>FirefoxESR, 31 ESR</li>
<li>Windows 7 enterprise, Service Pack 1</li>
</ul>
<h4 dir="auto">Your Code</h4>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&lt;script&gt;
  $(document).ready(function() {
    $(&quot;#target1&quot;).css(&quot;color&quot;, &quot;red&quot;);
    $(&quot;#target1&quot;).prop(&quot;disabled&quot;, true);
    $(&quot;#target4&quot;).remove();
    $(&quot;#target2&quot;).appendTo(&quot;#right-well&quot;);
    $(&quot;#target5&quot;).clone().appendTo(&quot;#left-well&quot;);

  });
&lt;/script&gt;

&lt;!-- Only change code above this line. --&gt;

&lt;body&gt;
  &lt;div class=&quot;container-fluid&quot;&gt;
    &lt;h3 class=&quot;text-primary text-center&quot;&gt;jQuery Playground&lt;/h3&gt;
    &lt;div class=&quot;row&quot;&gt;
      &lt;div class=&quot;col-xs-6&quot;&gt;
        &lt;h4&gt;#left-well&lt;/h4&gt;
        &lt;div class=&quot;well&quot; id=&quot;left-well&quot;&gt;
          &lt;button class=&quot;btn btn-default target&quot; id=&quot;target1&quot;&gt;#target1&lt;/button&gt;
          &lt;button class=&quot;btn btn-default target&quot; id=&quot;target2&quot;&gt;#target2&lt;/button&gt;
          &lt;button class=&quot;btn btn-default target&quot; id=&quot;target3&quot;&gt;#target3&lt;/button&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      &lt;div class=&quot;col-xs-6&quot;&gt;
        &lt;h4&gt;#right-well&lt;/h4&gt;
        &lt;div class=&quot;well&quot; id=&quot;right-well&quot;&gt;
          &lt;button class=&quot;btn btn-default target&quot; id=&quot;target4&quot;&gt;#target4&lt;/button&gt;
          &lt;button class=&quot;btn btn-default target&quot; id=&quot;target5&quot;&gt;#target5&lt;/button&gt;
          &lt;button class=&quot;btn btn-default target&quot; id=&quot;target6&quot;&gt;#target6&lt;/button&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/body&gt;
"><pre class="notranslate"><span class="pl-c1">&lt;</span><span class="pl-ent">script</span><span class="pl-c1">&gt;</span>
  $(document).ready(function() <span class="pl-kos">{</span>
    <span class="pl-en">$</span><span class="pl-kos">(</span><span class="pl-s">"#target1"</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">css</span><span class="pl-kos">(</span><span class="pl-s">"color"</span><span class="pl-kos">,</span> <span class="pl-s">"red"</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-en">$</span><span class="pl-kos">(</span><span class="pl-s">"#target1"</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">prop</span><span class="pl-kos">(</span><span class="pl-s">"disabled"</span><span class="pl-kos">,</span> <span class="pl-c1">true</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-en">$</span><span class="pl-kos">(</span><span class="pl-s">"#target4"</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">remove</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-en">$</span><span class="pl-kos">(</span><span class="pl-s">"#target2"</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">appendTo</span><span class="pl-kos">(</span><span class="pl-s">"#right-well"</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-en">$</span><span class="pl-kos">(</span><span class="pl-s">"#target5"</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">clone</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">appendTo</span><span class="pl-kos">(</span><span class="pl-s">"#left-well"</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

  <span class="pl-kos">}</span>);
<span class="pl-c1">&lt;</span><span class="pl-c1">/</span><span class="pl-ent">script</span><span class="pl-c1">&gt;</span>

<span class="pl-c1">&lt;</span><span class="pl-c1">!</span><span class="pl-c1">--</span> <span class="pl-v">Only</span> <span class="pl-s1">change</span> <span class="pl-s1">code</span> <span class="pl-s1">above</span> <span class="pl-s1">this</span> <span class="pl-s1">line</span><span class="pl-kos">.</span> <span class="pl-c1">--</span><span class="pl-c1">&gt;</span>

<span class="pl-c1">&lt;</span><span class="pl-ent">body</span><span class="pl-c1">&gt;</span>
  <span class="pl-c1">&lt;</span><span class="pl-ent">div</span> <span class="pl-c1">class</span><span class="pl-c1">=</span><span class="pl-s">"container-fluid"</span><span class="pl-c1">&gt;</span>
    <span class="pl-c1">&lt;</span><span class="pl-ent">h3</span> <span class="pl-c1">class</span><span class="pl-c1">=</span><span class="pl-s">"text-primary text-center"</span><span class="pl-c1">&gt;</span>jQuery Playground<span class="pl-c1">&lt;</span><span class="pl-c1">/</span><span class="pl-ent">h3</span><span class="pl-c1">&gt;</span>
    <span class="pl-c1">&lt;</span><span class="pl-ent">div</span> <span class="pl-c1">class</span><span class="pl-c1">=</span><span class="pl-s">"row"</span><span class="pl-c1">&gt;</span>
      <span class="pl-c1">&lt;</span><span class="pl-ent">div</span> <span class="pl-c1">class</span><span class="pl-c1">=</span><span class="pl-s">"col-xs-6"</span><span class="pl-c1">&gt;</span>
        <span class="pl-c1">&lt;</span><span class="pl-ent">h4</span><span class="pl-c1">&gt;</span>#left-well<span class="pl-c1">&lt;</span><span class="pl-c1">/</span><span class="pl-ent">h4</span><span class="pl-c1">&gt;</span>
        <span class="pl-c1">&lt;</span><span class="pl-ent">div</span> <span class="pl-c1">class</span><span class="pl-c1">=</span><span class="pl-s">"well"</span> <span class="pl-c1">id</span><span class="pl-c1">=</span><span class="pl-s">"left-well"</span><span class="pl-c1">&gt;</span>
          <span class="pl-c1">&lt;</span><span class="pl-ent">button</span> <span class="pl-c1">class</span><span class="pl-c1">=</span><span class="pl-s">"btn btn-default target"</span> <span class="pl-c1">id</span><span class="pl-c1">=</span><span class="pl-s">"target1"</span><span class="pl-c1">&gt;</span>#target1<span class="pl-c1">&lt;</span><span class="pl-c1">/</span><span class="pl-ent">button</span><span class="pl-c1">&gt;</span>
          <span class="pl-c1">&lt;</span><span class="pl-ent">button</span> <span class="pl-c1">class</span><span class="pl-c1">=</span><span class="pl-s">"btn btn-default target"</span> <span class="pl-c1">id</span><span class="pl-c1">=</span><span class="pl-s">"target2"</span><span class="pl-c1">&gt;</span>#target2<span class="pl-c1">&lt;</span><span class="pl-c1">/</span><span class="pl-ent">button</span><span class="pl-c1">&gt;</span>
          <span class="pl-c1">&lt;</span><span class="pl-ent">button</span> <span class="pl-c1">class</span><span class="pl-c1">=</span><span class="pl-s">"btn btn-default target"</span> <span class="pl-c1">id</span><span class="pl-c1">=</span><span class="pl-s">"target3"</span><span class="pl-c1">&gt;</span>#target3<span class="pl-c1">&lt;</span><span class="pl-c1">/</span><span class="pl-ent">button</span><span class="pl-c1">&gt;</span>
        <span class="pl-c1">&lt;</span><span class="pl-c1">/</span><span class="pl-ent">div</span><span class="pl-c1">&gt;</span>
      <span class="pl-c1">&lt;</span><span class="pl-c1">/</span><span class="pl-ent">div</span><span class="pl-c1">&gt;</span>
      <span class="pl-c1">&lt;</span><span class="pl-ent">div</span> <span class="pl-c1">class</span><span class="pl-c1">=</span><span class="pl-s">"col-xs-6"</span><span class="pl-c1">&gt;</span>
        <span class="pl-c1">&lt;</span><span class="pl-ent">h4</span><span class="pl-c1">&gt;</span>#right-well<span class="pl-c1">&lt;</span><span class="pl-c1">/</span><span class="pl-ent">h4</span><span class="pl-c1">&gt;</span>
        <span class="pl-c1">&lt;</span><span class="pl-ent">div</span> <span class="pl-c1">class</span><span class="pl-c1">=</span><span class="pl-s">"well"</span> <span class="pl-c1">id</span><span class="pl-c1">=</span><span class="pl-s">"right-well"</span><span class="pl-c1">&gt;</span>
          <span class="pl-c1">&lt;</span><span class="pl-ent">button</span> <span class="pl-c1">class</span><span class="pl-c1">=</span><span class="pl-s">"btn btn-default target"</span> <span class="pl-c1">id</span><span class="pl-c1">=</span><span class="pl-s">"target4"</span><span class="pl-c1">&gt;</span>#target4<span class="pl-c1">&lt;</span><span class="pl-c1">/</span><span class="pl-ent">button</span><span class="pl-c1">&gt;</span>
          <span class="pl-c1">&lt;</span><span class="pl-ent">button</span> <span class="pl-c1">class</span><span class="pl-c1">=</span><span class="pl-s">"btn btn-default target"</span> <span class="pl-c1">id</span><span class="pl-c1">=</span><span class="pl-s">"target5"</span><span class="pl-c1">&gt;</span>#target5<span class="pl-c1">&lt;</span><span class="pl-c1">/</span><span class="pl-ent">button</span><span class="pl-c1">&gt;</span>
          <span class="pl-c1">&lt;</span><span class="pl-ent">button</span> <span class="pl-c1">class</span><span class="pl-c1">=</span><span class="pl-s">"btn btn-default target"</span> <span class="pl-c1">id</span><span class="pl-c1">=</span><span class="pl-s">"target6"</span><span class="pl-c1">&gt;</span>#target6<span class="pl-c1">&lt;</span><span class="pl-c1">/</span><span class="pl-ent">button</span><span class="pl-c1">&gt;</span>
        <span class="pl-c1">&lt;</span><span class="pl-c1">/</span><span class="pl-ent">div</span><span class="pl-c1">&gt;</span>
      <span class="pl-c1">&lt;</span><span class="pl-c1">/</span><span class="pl-ent">div</span><span class="pl-c1">&gt;</span>
    <span class="pl-c1">&lt;</span><span class="pl-c1">/</span><span class="pl-ent">div</span><span class="pl-c1">&gt;</span>
  <span class="pl-c1">&lt;</span><span class="pl-c1">/</span><span class="pl-ent">div</span><span class="pl-c1">&gt;</span>
<span class="pl-c1">&lt;</span><span class="pl-c1">/</span><span class="pl-ent">body</span><span class="pl-c1">&gt;</span></pre></div>
<h4 dir="auto">Screenshot</h4>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://cloud.githubusercontent.com/assets/1185943/13295119/12a0c15e-db06-11e5-886b-e74b390970a6.png"><img src="https://cloud.githubusercontent.com/assets/1185943/13295119/12a0c15e-db06-11e5-886b-e74b390970a6.png" alt="sem titulo2" style="max-width: 100%;"></a></p>