Automatically "type" a string into an attribute of an element