Do you want see an element that you create in your HTML on console by JS?
It's so easy and simple.
there is no more explain about this, but you should know some small tips about it:
We can do this with using from
getElementById()
method.
this return one element with specified ID.
you should remember that: your IDs name should be unique.
and you should use "variables name rule" for your IDs name.Here our answer:
- select an element with this method like that:
document.getElementById("demo");
- This would return the full HTML element:
<h1 id="demo">Hello world.</h1>
- We should write our method in
console.log
as we know for see it in console:
console.log(document.getElementById("demo"));
Finally, I must mention, these things I said are about "HtmlDom" topic in JS.
Top comments (0)