Home > Web Front-end > JS Tutorial > body text

How to clear all tags under div_javascript tips

WBOY
Release: 2016-05-16 16:59:45
Original
1263 people have browsed it
复制代码 代码如下:




1




1







复制代码 代码如下:

function add1(){//添加一个div content-main
var obj=document.createElement("div");
obj.id="content-main";
obj.innerHTML='
'
'3'
'
';
$('#slides').append(obj);
}

function clear(){//清除slides下的所有div和img
var div1=document.getElementById("slides").getElementsByTagName("div");
for(var i=0;idiv1[i].innerHTML='';
}
}

复制代码 代码如下:

function ClearAllText(divInput){ //清空div下多有text文本框的内容,重置
var txts = document.getElementById('divInput').getElementsByTagName("input");
for(var i=0;i{
if(txts[i].type=="text"){
txts[i].value =""; //text 清空
}
}
var selects = document.getElementById('divInput').getElementsByTagName("select");
for(var i=0;i{
selects[i].options[0].selected = true; //选择第一项
}
}
Related labels:
div
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!