function call fails for jsElement.value from within element specification for displayValue
Closed this issue · 1 comments
the following works within attributes specifications but (similar) fails when attempting to use for element specification:
displayValue: function(jsAttribute) {if($.trim(jsAttribute.value)==""){return "MISSING VALUE"}else {return ""+jsAttribute.value} },
i.e., this fails:
displayValue: function(jsElement) {if($.trim(jsElement.value)==""){return "MISSING VALUE"}else {return ""+jsElement.value} },
with "undefined" output
This is a feature, not a bug. You should be calling jsElement.getText()
instead of jsElement.value
.
The value
property is defined only for attributes and text nodes. Elements don't have values. Instead, they have children which can be any combination of elements and text nodes. You can access the children of an element through jsElement.children
which returns an array of elements and text nodes. Or, if you are only interested in the (recursive) concatenation of all text nodes inside the element, call jsElement.getText()
.