Basically, if I rightclick in any browser and choose to view source the code won’t show up, even though i can clearly see the content on the page (tried on IE, Firefox, Chrome)
If I use the “inspect element” feature of Chrome/Firefox, I can however view the code
This is the respective code of my index.html:
<!-- [TABLE] -->
<div id="centercol" align="center">
<table id="table">
</table>
</div>
I’m using appendChild() to add the tr/td’s in my javascript
InspectElement : https://i.stack.imgur.com/k2x5u.png
View Source : https://i.stack.imgur.com/L4lRN.png
Why does this happen?
Viewing source code sees the hard code / static code, inspecting DOM shows dynamic code as it’s generated. You can get the generated source code using
innerHTML.