Quantcast
Channel: Adobe Community : All Content - FrameMaker Scripting
Viewing all articles
Browse latest Browse all 888

Get the default value for an element's attribute

$
0
0

I use this to get an attribute value that is assigned to a particular element:

 

var version = getAttributeValue (element, "TemplateVersion");
alert (version);

function getAttributeValue (element, name) {
        var attrList = element.Attributes, i = 0;    for (i = 0; i < attrList.length; i += 1) {        if (attrList[i].name === name) {            if (attrList[i].values[0]) {                return (attrList[i].values[0]);            }            else {                // If the attribute exists, but doesn't have a value, return an empty string.                return "";            }        }    }  // If the attribute doesn't exist, return undefined.
}

 

In this particular case, TemplateVersion is read-only and is assigned in the EDD as a default value. When I use the function above, it returns a blank string because the value has been set as a default and not explicitly set. How can I return the default value of the attribute? Thank you very much.


Viewing all articles
Browse latest Browse all 888

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>