为什么不removeAttribute()删除以下代码中的任何内容:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>test</title>
</head>
<body>
<div id="myDiv">
Element with style.
</div>
<br />
<br />
<button onclick="DelStyle()">
Remove the style attribute from the element
</button>
<script type="text/javascript">
function DelStyle() {
var div = document.getElementById("myDiv");
console.log(div)
div.style.border = 'solid #3B3B3D 1px';
console.log(div)
div.removeAttribute("style");
console.log(div)
}
</script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud) 
我有2个带有'position absolute'的兄弟节点,它们都处理mousedown事件.当我点击'div 2'的透明区域(在图片上)时,如何触发'div 1'的处理程序
这段代码有什么问题?
function test() {
(function(){
console.log('1')
})()
(function(){
console.log('2')
})()
}
test()
Run Code Online (Sandbox Code Playgroud)