How to access?
1. This works: <name>Joe</name>
nameElement[0].firstChild.nodeValue returns "Joe"
2. This does not work: <name></name>
nameElement[0].firstChild.nodeValue creates an error.
I have tried using a boolean operator to evaluate it (if nameElement....), but that does not work, either.
So, how am I to ever figure out I have an empty text tag?
Referencing an empty node
Moderator: General Moderators
-
jeffmatthews
- Forum Newbie
- Posts: 10
- Joined: Wed Oct 21, 2009 10:22 pm
Re: Referencing an empty node
Matt's a busy guy!
I found the answer. Must test: if (name[0].firstChild)...
What a joke! Who wrote the program to require such extraneous evaluations? It should just return null or an empty string, or whatever.
I found the answer. Must test: if (name[0].firstChild)...
What a joke! Who wrote the program to require such extraneous evaluations? It should just return null or an empty string, or whatever.