assuming you're keeping the <a> tag there are quite a few ways to
do this, here's a few: 1) $("div h1 a").appendTo("div"); $("div p, div h1").remove(); 2) var link=$("div h1 a"); $("div").html(link);// nothing left in div except <a> tag with this example, would wipe out anything else in div too 3) $("div h1 a").insertBefore("p").parents("div").find("p").remove(); be careful , very generic selectors used in example and some will remove every p in every div! only used as example, you'll need to be more specific with selector ID's, attributes or classes. Clare wrote: hi all, I have something like below: <div> <p> <h1> <a href="">My Link</a> </h1> </p> </div>I'd like to get rid of only the inner tags, 'p' and 'h1'. Any help would greatly be appreciated. |
- [jQuery] Removing Inner Tags Clare
- [jQuery] Re: Removing Inner Tags Charlie