return from each

return from each

Hello please help to solve the problem.
I have this type of constructions. That geting id from the link clicked. (front & back values). Construction bottom getting wear types (tshirt, etc).

  1. $('.side a').each(function() {
  2. $(this).on("click", function() {
  3. var sside = $(this).attr('id');
  4. });
  5. });
  6. // I need sside here. How to return it?


  1. $('.wtypes a').each(function() {
  2. $(this).on("click", function() {
  3. var stype = $(this).attr('id');
  4. return stype;
  5. });
  6. });
  7. // I need stype here. How to return it?

I need to have that values to reach right bolder with wear picture.

var destination = "./pictures"+stype+sside ;

How to return values from each function?