【发布时间】:2019-03-23 08:17:45
【问题描述】:
<div id="div-02">Here is div-02</div>
var el = document.getElementById('div-02');
el.remove(); // Removes the div with the 'div-02' id
setTimeout(() => {
el.add?... },5000)
我想删除该元素 5 秒钟,并使其与之前相同(在删除之前)。
【问题讨论】:
-
也许可以试试
display: none -
只是要求澄清一下,要删除5秒再恢复吗?如果是这样,您可以隐藏和显示
-
你好,可以用jquery还是纯js?
-
我正在做 Angular 项目,所以可能是纯 js,但 hide and show 解决了我的问题,我走错了方向
标签: javascript