99
rated 0 times
[
100]
[
1]
/ answers: 1 / hits: 20649
/ 12 Years ago, fri, july 20, 2012, 12:00:00
I am trying to use a ternary operator to check if the value of an XML element is null. If it is then I want the variable to be one thing. If not then I would like it to return the value of element. This is what I have so far.
var rating = data.getElementsByTagName(overall_average)[0].childeNodes[0].length > 0 ? data.getElementsByTagName(overall_average)[0].childeNodes[0].nodeValue : It is empty;
More From » xml