Post #1868665
2026-04-09 11:24 UTC
today i learnt that if you have an HTML element with an id like:
<div id=“test”>Hello</div>
You can just use the variable test directly in a script tag.
<script>
test.innerHTML = “Hello World”;
</script>
You don’t need a getElementByID.
Replies (1)
-
@niyabits@hachyderm.io 2026-04-09 11:25
I was reading a test where an id is used like this and I was unable to figure out if the imported test harness does some magic apparently it happens by default…