This may not work for groups and group-based elements (date, hierselect). To ensure proper behaviour, you should update attributes of grouped elements manually.
Parameter
mixed
$elements
Array of element names/objects or string of elements to be updated