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 8500049
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T00:50:04+00:00 2026-06-11T00:50:04+00:00

I am trying to follow the outline in this thread to dynamically change the

  • 0

I am trying to follow the outline in this thread to dynamically change the color swatch of a split button list view by changing the data-theme. Interestingly, the scheme works when I put in an alert statement in the javascript, but when I take the alert out, this doesn’t work well.

Here is the sample:

  • With alert: http://jsbin.com/ifodij/4/
  • Without alert: http://jsbin.com/ifodij/3/ (try toggling on two buttons before trying to toggle off)

Any suggestion as to why this is happening and what I might be missing? Thanks.

  • 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-11T00:50:06+00:00Added an answer on June 11, 2026 at 12:50 am

    I’m not too sure as to the cause. But this is how I would re-write what you are doing (which appears to fix the problem):

    Firstly, remove your inline javascript (onclick="toggleChecked('2', 'TR02')") from the HTML.

    Next, replace your toggleChecked() function with the following javascript:

    $(document).ready(function(){
       $('a[id^="star"]').on("click", function(){
    
          if ($(this).data("theme") == "d") {
             $(this).buttonMarkup({ theme: 'e' }).button();
          } else {
             $(this).buttonMarkup({ theme: 'd' }).button();
          }
       });
    });
    

    The above is an event listener, that will check to see when any anchor with an id starting with star is clicked.

    Refreshing the button appears to be a bit buggy, often classes from the previous theme hang around despite rebuilding the button.


    UPDATE

    Actually scrap the above, it seems like such a convoluted way of achieving a selected button. Why not just change the CSS, using the above as a guide, remove the inline styles and use the following jQuery:

    $(document).ready(function(){
       $('a[id^="star"]').on("click",function(){
          $(this).toggleClass("ui-btn-pressed");
       }); 
    }); 
    

    Here is a jsbin: http://jsbin.com/ifodij/8/edit

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to follow this example. (Section String sorting...) Is there anything obvious that would
I'm trying to follow these docs: http://readthedocs.org/docs/neo4j-rest-client/en/latest/indices.html This works fine from neo4jrestclient.client import GraphDatabase,
I am trying to follow this article to do the same for adding a
I'm trying to follow this tutorial using StructureMap : http://iridescence.no/post/Constructor-Injection-for-ASPNET-MVC-Action-Filters.aspx What I'm trying to
Trying to follow some basic examples and getting stuck by this code that is
Trying to follow this tutorial. Autotest fails with this error message: sg $autotest loading
Trying to follow this tutorial Walkthrough: Part 1 - Creating a Basic Project System
trying to follow this tutorial http://www.codeguru.com/csharp/csharp/net30/article.php/c15489 I'm not able to select the sql server
Im trying to follow this article for having simultaneous pan and pinch gesture recognizers
Trying to follow this tutorial, but my installation of mysql is failing. After getting

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.