Creating variables/array from class selector

Creating variables/array from class selector

I'm new to js and jQuery and amazed by the ease jQuery presents in common javascript tasks and dom tasks.

With that being said, I'm looking for some advice to point me in the right direction with a project I am working on. I have a row of images in a div. I have employed the jQuery toggle function to toggle on and off a class of 'active' on the images when they are clicked. I will now need to somehow read the images that are active, and then create a set of variables, or an array with unique ids to let me know which images are selected and deemed 'active'.

I will be using the list of active selected images in a php form submit; so will probably employ the js variable somewhere within hidden form inputs.

Any help or advice in somehow creating a variable/array of group of elements with class='active' would be greatly appreciated! I can submit code and screenshot examples tomorrow from work as needed.

BONUS POINTS (optional) ! In my toggle on and off, Ideally, I would only like the viewer to be allowed to toggle ON two items, in a group of probably 6 images within the div.