Can I assign an id to html code, without giving it any special attribute?
Specifically what I want is to be able to change my html code using JS.
I found that I can use this in html:
abc <b id="myID">def</b>
and then this in JS:
document.getElementById('myID').innerHTML = "123";
But this cause my text to be bold. I tried writing the following but it doesn’t work:
abc <id="myID">def</id>
You could use a div:
or a span:
and then: