I have a div in which id is generated with index like gal1,gal2,gal3,gal4....
var clickid=\"gal\" + index; $(\'WANT TO PLACE clickid HERE\').click();
Like this:
$('#' + clickid).click();
Since it is an id, you need to prepend # to it so that jQuery is able to find it out. This is similar to CSS :)
id
#
For more info, have a look at:
$("#" + clickid).click();