In wikispaces, they use one of two HTML elements as buttons in a wikispace. Here they are…
<button name="lock" type="submit" class="btn"><span><span>Lock Topic</span></span></button>
Or…
<a onclick="jQuery(this).parents('form').submit();" class="btn"><span><span>Search Posts</span></span></a>
<a class="btn primary" id="newPostTrigger" href="#"><span><span><img width="11" height="14" alt="New Post" src="http://www.wikispaces.com/i/icon_14_add.png"/> New Post</span></span></a>
As you can see in this photo below, I’ve cleaned up the buttons quite a bit with some CSS.

But with all those unnecessary <span>‘s, I’m having to use a lot of CSS to deal with all of the default CSS that wikispaces inserts for the spans.
How could I remove the <span>‘s within both the a.btn element, as well as the button element with jQuery?
Thanks for your help!
In jQuery 1.4 use
unwrap()provides a partial solution:You can only unwrap elements not text however so your example with text in the inner span won’t work with this. A slightly messier but more general solution (that’ll work with jQuery 1.3) is:
Here’s an example:
with:
and: