setElementAttr function

Set the attributes of an element