Filter a data-attribute and return the corresponding id in an array.

Filter a data-attribute and return the corresponding id in an array.

Is it possible to do the following;  I want to filter through a div for to match a data-attribute. When it is correct how can I return the corresponding id in array so it can be used in the for/next loop after.


Thanks in advance.