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

  • Home
  • SEARCH
  • 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 9186141
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:27:05+00:00 2026-06-17T19:27:05+00:00

I used the solution to this question in my project to change the icon

  • 0

I used the solution to this question in my project to change the icon of a button when the user clicks on it:

 $('#buttonSwitch').buttonMarkup({icon: "minus"});

However, not only the icon but also the shape of the button changes (the rounded corners):

Before the click: before the click

After the click: after the click

You can find a minimal example here: -removed-

I would like to know how I can just change the icon without changing the shape of the button.
Thanks in advance for your help.

Edit: There is still one little problem. After the click, the button has this small white border on the bottom:

before the click after the click

  • 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-06-17T19:27:06+00:00Added an answer on June 17, 2026 at 7:27 pm

    It’s because you have custom CSS (border-radius) on your button. And the buttonMarkup function sets the border-radius to default. So, you have to store the current border-radius, change the button, and restore the border-radius.

    Modify your JS function to:

    function switchIcon() {
        iconSwitched = !iconSwitched;
    
        /* Store the objects */
        var button = $('#buttonSwitch');
        var parent = button.parent();
        var sibling = button.siblings().filter('span').first();
    
        /* Store the border-radius */
        var br = button.css('border-radius');
        var pr = parent.css('border-radius');
        var sr = sibling.css('border-radius');
    
        if (iconSwitched)
            button.buttonMarkup({icon: "minus"});
        else
            button.buttonMarkup({icon: "add"});
    
        /* Now, the border-radius has been set using the buttonMarkup function
         * We need to restore it to our custom border-radius to get our custom radius back.
         * Note that you may want to also set -webkit-border-radius 
         * and -moz-border-radius as well
         */
        button.css('border-radius', br);
        parent.css('border-radius', pr);
        sibling.css('border-radius', sr);
    
        /* Get rid of box shadow too */
        parent.css('box-shadow', 'none');
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I used the mapping solution from this question to have a joined component. But
Previous I issued a question on how to change Maven project vesion from command
I feel dumb asking this question, but I can't find solution to this myself.
I have used the cURL solution to solve XSS but there is an issue
My VS2008 solution has the following setup. Program1 Program2 Common.dll (used and referenced by
Having used storyboards for a while now I have found them extremely useful however,
This question and answers discuss the theory as well as methods to achieve the
Update: A sample project reproducing this bug can be found here at Microsoft Connect
This is a bit of subjective question about a specific situation. Main goal for
This question is kind of lengthy but I try to provide you with the

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.