问题
I can set elements with setProperties, but there does not seem to be a getProperties to get an attribute value. Can anyone help?
回答1:
If you just want to return the attribute value use raw javascript method getAttribute(att_name).
Or if you get an attribute node by name from the current element use getAttributeNode(att_name)
var elem = goog.dom.getElement(element);
var attr = elem.getAttribute('name');
var attrNode = elem.getAttributeNode('name');
来源:https://stackoverflow.com/questions/17592626/in-google-closure-how-can-i-get-a-property-from-a-dom-element