Dear experts, I am quite new to javascript and I often see coders use those lines interchangeabaly.
document.body.getElementsByTagName();
and
document.getElementsByTagName();
What is the difference, benefits?
Does this have anything to do with FF and IE?
The difference is the context. In the first example you're looking inside the body tag which means you can never retrieve the body tag itself or any other elements outside of that
In the second example example you can retrieve anything.
Nothing to do with specific browsers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With