[wd_asp elements=’search’ ratio=’100%’ id=1]

Jquery index – Show content with same index

15th April 2014

Jquery Misc

jquery icon

If you have 20 pictures (class of .picture) and 20 hidden items (class of .addcomment), then when you click on the 3rd picture, then it will show the third .addcomment.
This is instead of naming 20 different classes.


var idx = $('.picture').index(this);
$('.addcomment').eq(idx).show();