【发布时间】:2017-11-19 11:54:27
【问题描述】:
有没有办法检查页面上是否存在 div 元素,如果存在则找到该页面的 h1,将其从所在位置删除,然后将其添加到找到的 div 元素内?示例:
<div id="banner">
<!---find if this div exists first--->
</div>
<div class="page">
<h1>Then find this and add it instead to above banner</h1>
</div>
如果顶部横幅不存在,则页面需要保持不变。
【问题讨论】:
-
所以看看它是否存在,找到h1并附加它。有什么不知道该怎么做的吗?
标签: javascript jquery html css