0

Help

I am a jss beginner.Q1 Why can't I use ${}. Q2 I can't change textContent(it is showing can't get the text of null)

12th Feb 2024, 10:46 AM
Sky🌌
Sky🌌 - avatar
4 Answers
0
1. We cannot access an html document before it is loaded. Wrap your JS code in window.onload function. 2. String literals are makred with `` , not with "". See corrected code: window.onload = function() { let y=document.getElementById("a") console.log(y.textContent) let x=prompt() console.log(`sjsjdjsj ${x}`) }
12th Feb 2024, 11:06 AM
Lisa
Lisa - avatar
+ 1
L I N K YOUR CODE.
12th Feb 2024, 10:52 AM
Lisa
Lisa - avatar
0
Also, you are just logging to console and don't set any gtml content yet.
12th Feb 2024, 11:08 AM
Lisa
Lisa - avatar