Basic dom
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>replit</title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<button onclick="console.log('button was clicked')" >click Me</button>
<script src="index.js"></script>
</body>
</html>
---------------------------------------------------
let btn =document.querySelector("button")
console.dir(btn);
function func (){
alert("btn was clicked")
}
btn.onclick = func
Comments
Post a Comment