Reputation: 1124
Why does
theMenuSection.innerHTML='<ul>';
alert(theMenuSection.innerHTML);
Produce <ul> </ul>
just i have the opening tag.can i get <ul>
from innerHTML tag
thanks
Upvotes: 0
Views: 111
Reputation: 113
Typically (this is per-browser dependent) when you interact with the DOM, or utilize innerHTML (which interacts with the DOM), you will see the browsers "corrected" interpretation of what the HTML should look like. Same reason why Firefox auto-injects "thead" elements into tables when your source code doesn't have any of that. The browser is trying to infer 'correct' HTML from what it sees.
Upvotes: 1