On Thu, May 7, 2009 at 8:08 PM, dduck1934 <dduck1...@gmail.com> wrote: > > im trying to get the syntax down to find all img tags that are NOT > surrounded by <p> tags and wrap those img tags in <p> tags. > > I can get the selector to get all img tags and wrap it in a <p> tag > but i need to further take it to disregard the img tags that already > are wrapped in <p>
with my usual disclaimer that the following code might suck: $('img').each(function(){ if ($(this).parent().get(0).tagName != "p") { $(this).wrap(document.createElement('p')); } }); -- I have failed as much as I have succeeded. But I love my life. I love my wife. And I wish you my kind of success.