示例代码
- 如下
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>two</title>
<script>
console.group("one pass");
function funIDcard(){
var ipt = document.createElement("input");
ipt.setAttribute("type","text");
ipt.setAttribute("name","test");
var div = document.getElementById("test");
div.appendChild(ipt);
alert("111");
};
</script>
</head>
<body>
<form>
<div id="test">
<input type="text" name="test" style="display:none;"/>
</div>
<input type='button' value='添加' onclick="funIDcard()"/>
</form>
</body>
</html>