I have XML:
<street></street>
or
<street>2813 Bla ave</street>
Javascript:
if ((xmldoc.getElementsByTagName('street')[i].firstChild.nodeValue != null)) {
alert(1);
}
alert(2);
But the script doesn’t work – Cannot read property ‘nodeValue’ of null
nodeValuewill never benullbecause without a value the node wouldn’t exist.Remove
.nodeValuefrom your code.