Tuesday, February 19, 2008

On Trusting the Internet

The other day, I was doing some JavaScript coding, and needed to find an element in the HTML document. Don't worry if you don't understand the technical details--the message of this post does not depend on them.

I remembered that there was a way to find an element by its identifier (or "id" for short), so I did a quick google of "findelementbyid" (which is what I remembered it being called) and got a whole bunch of results. The second one on the results list even included the excerpt, "FindElementById has yet to fail me" which sounded very reassuring.

However, it did fail me. Hmph!

I turned to my trusty reference book on JavaScript and there was no "findelementbyid" in the index. Very curious. So, I turned to "document" in the reference section and it wasn't listed there either. Curiouser and curiouser.

However, in the reference section, there was a mention of "getelementbyid".

Aha!

Why did I trust the Internet?

I've just done a comparison, and a google of "findelementbyid" returns only 556 results (YMMV) which, in retrospect is awfully small.

Sure enough, a google of "getelementbyid" returns "about 5,410,000" results. (Again, YMMV.)

The moral of the story: exercise care when using the Internet as an authority.

1 comment:

Myrna said...

Isn't that what we librarians have been saying for a long time?