getting all attributes and values of an element

getting all attributes and values of an element

Hello. Let's say I have an element such as:

<div class='my_firstClass my_secondClass' data='my_data' myCustomAttr='my_custAttr">test</div>

I would like to be able to get all of the attributes and their values with an output similar to:

[0] class: { my_firstClass, my_secondClass }
[1] data: { my_data }
[2] myCustomAttr: { my_custAttr }

Does anyone know of a way to do this?
Thanks!