View source does not show elements which were added by javascript to the DOM
Hi Everyone,
Does anyone know why the elements which were added to the DOM by java script are not available when I try to view source? The element were there but are missing when try to view source.
Does anyone know why the elements which were added to the DOM by java script are not available when I try to view source?
Because javascript adds them dynamically, or the View Source shows only the static elements. JavaScript does not write physically the new elements. It creates them on the client-side. Let's say, virtually.
But what bothers you? If you want to see the javascript new created elements/attributes by all means, use Firefox and install the Add-on called FireBug.
Because the JavaScript-created elements are created after the HTML code has already been parsed by the browser, and the "View Source" only shows you the code received by the browser - anything done browser-side (like JavaScript-created elements done by browser during parsing) is too late for the "View Source" snapshot.
Yes, it bothers me a lot because I want to debug by page by check the DOM though view source. Currently, I am using IE9, are there any plugin to help me to see those elements?
Bookmarks