jQuery: appendTo parent

Posted by Kenneth B on Stack Overflow See other posts from Stack Overflow or by Kenneth B
Published on 2011-01-13T12:14:41Z Indexed on 2011/01/13 12:54 UTC
Read the original article Hit count: 300

Filed under:
|
|

Hi guys

I can't seem to get the appendTo to work. What do I do wrong?

$('div:nth-child(2n) img').appendTo(parent);

Current markup:

<div class="container">
  <img src="123.jpg" />
  <p>Hey</p>
</div>
<div class="container">
  <img src="123.jpg" />
  <p>Hey</p>
</div>

I want this output:

<div class="container">
  <p>Hey</p>
  <img src="123.jpg" />
</div>
<div class="container">
  <p>Hey</p>
  <img src="123.jpg" />
</div>

Please help me guys... I'm tearing my hair of every minute.. :-S

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about append