如何更改选定元素的多个实例的位置
我需要将每个 h3 元素从下面的位置移动到新位置,作为 .summary-inside-wrapper 的第一个子
元素 我尝试过的所有操作都将所有 h3 元素的实例移动到每个摘要中。我只需要移动每个摘要中的原始内容。
<div class="content-main">
<div class="summary" id="listing_summary_3547">
<div class="share"></div>
<div class="summary-inside-wrapper">
<div class="summary-inside"> <---- TO HERE ---|
<div class="left"> |
<div class="title"> |
<h3>unique text here 1</h3> -- MOVE THIS h3 ---|
<p>some other text here</p>
</div>
</div>
<div class="right"></div>
</div>
</div>
</div>
<div class="summary" id="listing_summary_45741">
<div class="share"></div>
<div class="summary-inside-wrapper">
<div class="summary-inside"> <---- TO HERE ---|
<div class="left"> |
<div class="title"> |
<h3>unique text here 1</h3> --and MOVE THIS h3 ---|
<p>some other text here</p>
</div>
</div>
<div class="right"></div>
</div>
</div>
</div>
<div class="summary" id="listing_summary_6">
<div class="share"></div>
<div class="summary-inside-wrapper">
<div class="summary-inside"> <---- TO HERE ---|
<div class="left"> |
<div class="title"> |
<h3>unique text here 1</h3> --and MOVE THIS h3 ---|
<p>some other text here</p>
</div>
</div>
<div class="right"></div>
</div>
</div>
</div>
</div>
我尝试过 insertBefore()、prepend() 等,但没有得到预期的结果。每次我都会在摘要的每个实例中获取每个 h3 的副本。
I need to move the each of the h3 elements from their position below to a new position as first child of .summary-inside-wrapper
Everything I have tried moves an instance of ALL the h3 elements into each summary. I need for only the original within each summary to be moved.
<div class="content-main">
<div class="summary" id="listing_summary_3547">
<div class="share"></div>
<div class="summary-inside-wrapper">
<div class="summary-inside"> <---- TO HERE ---|
<div class="left"> |
<div class="title"> |
<h3>unique text here 1</h3> -- MOVE THIS h3 ---|
<p>some other text here</p>
</div>
</div>
<div class="right"></div>
</div>
</div>
</div>
<div class="summary" id="listing_summary_45741">
<div class="share"></div>
<div class="summary-inside-wrapper">
<div class="summary-inside"> <---- TO HERE ---|
<div class="left"> |
<div class="title"> |
<h3>unique text here 1</h3> --and MOVE THIS h3 ---|
<p>some other text here</p>
</div>
</div>
<div class="right"></div>
</div>
</div>
</div>
<div class="summary" id="listing_summary_6">
<div class="share"></div>
<div class="summary-inside-wrapper">
<div class="summary-inside"> <---- TO HERE ---|
<div class="left"> |
<div class="title"> |
<h3>unique text here 1</h3> --and MOVE THIS h3 ---|
<p>some other text here</p>
</div>
</div>
<div class="right"></div>
</div>
</div>
</div>
</div>
I have tried insertBefore(), prepend() and many more without the desired results. Each time I get copies of EVERY h3 inside each instance of the summary.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
代码:
这是一个现场演示
Code:
here is a Live Demo
这应该可以解决问题
this should do the trick