I just have a simple problem using getElementById.innerHTML like this:
document.getElementById('example').innerHTML = fullName;
Its not working at all. I know its pretty simple but I do not know how its not working.
I've also tried innerText
.
The composition is like this:
./index.js
./index.html
html:
<!DOCTYPE html>
<html lang="en">
<head>
<script src="index.js"></script>
<title>JS Course</title>
</head>
<body>
<p id="example"></p>
</body>
</html>
index.js
let word = 'Michal'
let word1 = 'Ruzicka'
const fullName = `${word} ${word1}`
console.log(fullName);
document.getElementById('example').innerHTML = fullName;