Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 552809
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:32:21+00:00 2026-05-13T11:32:21+00:00

In wikispaces, they use one of two HTML elements as buttons in a wikispace.

  • 0

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.

alt text

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!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T11:32:22+00:00Added an answer on May 13, 2026 at 11:32 am

    In jQuery 1.4 use unwrap() provides a partial solution:

    $(".btn > span > span > img").unwrap().unwrap();
    

    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:

    $(".btn").each(function() {
      $(this).html($(this).find("div:last").html());
    });
    

    Here’s an example:

    $(function() {
      $("#unwrap").click(function() {
        $("div.btn").each(function() {
          $(this).html($(this).find("div:last").html());
        });
      });
    });
    

    with:

    div.btn { background: yellow; padding: 15px; margin: 15px; }
    div.btn div { background: green; padding: 15px; }
    div.btn div div { background: red; padding: 15px;
    

    and:

    <div class="btn">
      <div>
        <div><img src="logo.gif"></div>
      </div>
    </div>
    <div class="btn">
      <div>
        <div>Some text</div>
      </div>
    </div>
    <input id="unwrap" type="button" value="Unwrap">
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let me clarify my question, and the solution I'm looking for. I'm using wikispaces.com,
In Wikispaces, when you add a Table of Contents to the Main Content area,
I've started learning 16-bit assembly (eventually moving up to 32-bit) from this tutorial here:
Let me give a better description of exactly what I'm wanting to do here.
This is my first post here and since I've seen many great answers I
I have a sidebar list of links in my wikispace theme that currently uses
I'm trying to download the following page: http://structureddata.wikispaces.com/Test wget without any option fails: wget
Let's say you have to [write from scratch, rewrite, refactor] a sample program illustrating
Hi I have to have a popup WYSIWYG editor into my ROR application. I
I'm trying to write a TTL decorator in python. Basically I give it raise

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.