By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,460 Members | 1,193 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,460 IT Pros & Developers. It's quick & easy.

getElementById() off a non-document node

P: n/a
can getElementById() be called off a non-document node.

on page load

temp = document.body;

document.body = set-to-blank...

var elem = temp.getElementById("my_id");

Jun 23 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
ppcguy wrote:
can getElementById() be called off a non-document node.

on page load

temp = document.body;

document.body = set-to-blank...

var elem = temp.getElementById("my_id");


No, - getElementById - is a method of the document only. However, as an
ID is supposed to be unique to the entire document there is not
advantage in calling it on any given node in the tree anyway, except
maybe to determine that no element with that ID was a descendant of the
node on which it would have been called.

Richard.

Jun 23 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.