[英]I don't know what's wrong when i click the button nothing work
var zer = document.getElementById("zer");
zer.addEventListener("click", function(){
document.getElementById("info").innerHTML = "Hello World";
})
Hope you get where you were wrong. 希望你能找到你错的地方。
The best practice is to keep the scripts at the end so that all the html code is loaded and then the scripts are loaded. 最佳做法是将脚本保留在末尾,以便加载所有html代码,然后再加载脚本。
<!DOCTYPE html>
<html>
<head>
<link href="style.css" rel="stylesheet">
</head>
<body>
<div id="container">
<button id="zer" >click here</button>
<div id="info"></div>
</div>
<script src="script.js"></script>
<script src="jquery-3.3.1.min.js">
</body>
</html>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.