console.log("connected");
var one = document.getElementById("Click")
console.log(one);
one.addEventListener('click',function a() {
one.textContent = 'Clicked';
})
Even Variable one is printed null in console
The HTML code is:
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<script src="x.js"></script>
<h1 id="Click">Click</h1>
</body>
</html>