Reputation: 57
I have multiple Divs with an H1-Tag inside. Like this:
<div id="home">
<div class="link-container">
<h1>headline</h1>
<div class="image-inner">
<img src="img.jpg" width="300" height="380" alt="">
</div>
<p>Evel et rest, volesequos quo venditem labore cone repelia voluptatat reidertum.</p>
<div class="content-inner"></div>
</div>
<div class="link-container">
<h1>headline</h1>
<div class="image-inner">
<img src="img.jpg" width="300" height="380" alt="">
</div>
<p>Evel et rest, volesequos quo venditem labore cone repelia voluptatat reidertum.</p>
<div class="content-inner"></div>
</div>
</div>
The Problem is, that i want the H1-Tag inside the content-inner Div. But how? With this Code, i have all H1-Tags in the first Div.
$("#home h1").appendTo(".content-inner");
Upvotes: 0
Views: 288
Reputation: 208002
Use:
$('#home div.link-container').each(function () {
$(this).find('h1').appendTo($(this).find('div.content-inner'))
})
Upvotes: 2