Reformatting a table based photo gallery to a UL based gallery
- by mmsa
I have the following code:
var table = $('.photogalleryTable').before('<ul class="photogallery"></ul>')
table.find('td a').wrap('<li>').parent().appendTo('ul.photogallery');
table.remove();
This code finds a table with a list of photos and re-codes it to use a unordered list instead. The script works perfectly except for one issue. If there are 2 galleries on a page, the script will grab all of the images and reformat them into one list. Because the CMS I'm using tags each gallery table with .photogalleryTable, I'm not sure how to keep the script from touching the other galleries. What I would like to have happen is have the script re-format the first instance and then move on to the next instance, keeping the list of photos separate Is that possible?