Daniel St. Jules Posted January 10, 2010 Share Posted January 10, 2010 Hey everyone, I was hoping to receive a little help in figuring out how to accomplish this fix of mine. For a recent design I need to create a little workaround for IE. Basically I need to find all td's with class "a, and create a div within those td's, surrounding its contents with class "b". So, if I had <table> <tr> <td class="a"> Content here <table> <tr> <td class="a"> More Content here </td> </tr> </table> </td> </tr> </table> It would render as: <table> <tr> <td class="a"><div class="b"> Content here <table> <tr> <td class="a"><div class="b"> More Content here </div></td> </tr> </table> </div></td> </tr> </table> Now, I figure I can use RegExp to get the td's with the class name "a", but I have no idea how to dynamically create a div like that, particularly finding a closing td that belongs to an opening td with class "a". Any thoughts on how to accomplish this? Thanks very much! Link to comment https://forums.phpfreaks.com/topic/187943-create-div-within-elements-based-on-class/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.