Using $(".div-with-class")[my-variable]

Using $(".div-with-class")[my-variable]

Hi,

I've got a gallery and want to blend in / out the elements specified by a link parsing the element-position to a function.

  1. function showImageByPosition(position) {
  2.       $(".div-with-class")[position].show();
  3. }

As long as "position" is written hard coded as a number, it works. As soon as I want to use the parsed variable, it stucks. Has anyone an idea?

Cheers, Mario