Here you go.
Remember it's based on the original.
Mostly all that has been done is  the keys have been given attributes  depending on what they need (i.e  not all share the same  data key names)
The values for the attributes are the class names I used before.
And the code adjusted to look for the attributes instead of the class.
The keys no longer have innerHTML for it's key value initially.
This is now linked to the  data-elkey attribute.  And is set by ::before styling in a head css, which also uses the attribute.
So the code now just changes the data-elkey and the css will do the rest.