You could try something like this (untested): var photo = $('.Photo'); photo.before('<table><tr><td></td><td class="content"></td><td></td></tr></table>') .prev().find('td.content').append( photo );
Karl Rudd On 2/13/07, Ryan Doom <[EMAIL PROTECTED]> wrote: > Hey guys, does Jquery not get along with complex HTML table wrapping or > handling? > I have been playing with Jquery for about a week now and have had a lot of > success with it, however I'm trying to put a border around a photo. > > This is my HTML > > <img class="Photo" src="photodrop/woman.jpg"/> > > Here is my Ready data > $(".Photo").before("<table border='0' cellpadding='0' > cellspacing='0' width='1'><tr><td><img src='photodrop/topLeft.jpg'></td><td > background='photodrop/topBG.jpg' align='right'><img > src='photodrop/topMiddle.jpg'></td><td><img > src='photodrop/topRight.jpg'></td></tr><tr><td > background='photodrop/leftBG.jpg' valign='top'><img > src='photodrop/leftMiddle.jpg'></td><td>").after("</td><td valign='bottom' > background='photodrop/rightBG.jpg'><img > src='photodrop/rightMiddle.jpg'></td></tr><tr><td><img > src='photodrop/botLeft.jpg'></td><td background='photodrop/botBG.jpg' > align='left'><img src='photodrop/botMiddle.jpg'></td><td><img > src='photodrop/botRight.jpg'></td></tr></table>"); > > The above inserts the border etc but my second row has no middle column, the > center td are killed, and the img of the woman doesn't get the border around > it. > > Ive also tried using the wrap command which fails in its own different way. > Is there some problem with the above HTML ? I know a maze of Divs would > probably be better but the border is pretty complex. > > Thoughts? > > Ive' also tried this simple example > > $(".Photo").before("<table border='0' cellpadding='0' cellspacing='0' > width='1'><tr><td>x </td><td>").after("</td><td>y</td></tr></table>"); > > > This doesn't work as expected either, in the DOM all the table data is > before the IMG, only the y is after, but it is mal formed in the DOM. > > Thanks > > Ryan Doom > [EMAIL PROTECTED] > www.webascender.com > ============================ > office : 517.579.0420 > mobile : 517.507.9274 > ============================ > Web (Sites, Marketing and Tracking) > > > > > _______________________________________________ > jQuery mailing list > discuss@jquery.com > http://jquery.com/discuss/ > _______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/