I would use: $('a').click(function(){ var car_id = parseFloat($(this).attr('class')); $('#' + car_id).show(); });
Haven't tested this, but should work if I read your description right. Greetz, Rick On Dec 18, 1:57 pm, imot3k <r.imp...@gmail.com> wrote: > Hi, > > I'm making a website for a garage. In the cars section I generate the > cars list thru PHP. In the table there is a link to the details of the > car. There is also a picture which can be clicked to go the details. > > So it would look something like this: > > <td rowspan="3" width="13\"><a class="info6" href="#"><img src="../ > website_patrick/images/6.jpg" width="114" height="77" border="0" > alt="" /></a></td> > <td colspan="4" class="more_info"><a class="info6" href="#">more info</ > a></td> > > I've given a class to each of the links. The class name = info + > car_id. > > Then I also have a div which has an id equal to the car_id and which > is hidden. Now when you click either the picture or regular link the > div should be displayed. > > How can i achieve this? > > Thanks in advance