我写的是
<div id="sample">
....
....
<a class="uploadedfiles" href="www.google.com">File</a>
.....
.....
<div class="diagram"></div>
.....
.....
.....
</div>
现在我想要带有类上传文件的 anchor 标记应附加到 带有 jQuery 类图的 div 输出应为
<div class="diagram"><a href="www.google.com">File</a></div>
最佳答案
或者简单地说
$('.diagram').append($('.uploadedfiles').removeAttr('class'))
如果您有很多链接要附加到图表 div,您可以使用
$('.uploadedfiles').each(function(){
$(this).appendTo('.diagram').removeAttr('class')
})
关于javascript - 如何将 anchor 标记从一个地方附加到另一个地方?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24104116/