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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T02:03:40+00:00 2026-06-08T02:03:40+00:00

Could you try this simple example and tell me what’s going wrong: http://jsfiddle.net/ca11111/unQWP/1/ .

  • 0

Could you try this simple example and tell me what’s going wrong: http://jsfiddle.net/ca11111/unQWP/1/. The li theme is changed, but the listview refresh cannot update it.

The same problem occurs if I want to update the right button theme: http://jsfiddle.net/ca11111/unQWP/2/. I get the error:

Uncaught TypeError: Cannot call method 'removeClass' of undefined

=================================================

Can I know why this ALMOST work but doesnt.., (need 2 click, to change, and can’t get back)

http://jsfiddle.net/ca11111/unQWP/5/

it should toggle theme

  • 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-08T02:03:41+00:00Added an answer on June 8, 2026 at 2:03 am

    You can accomplish what you want by using the code here: http://jsfiddle.net/kE8GJ/. Note that the most important part of the code is this conditional:

    var element;
    
    if ($(this).hasClass("ui-li-link-alt")) {
        element = $(this);
    }
    else {
        element = $(this).closest('li.ui-li');
    }
    
    element
        .removeClass("ui-btn-up-c ui-btn-hover-c")
        .addClass("ui-btn-hover-e")
        .attr("data-theme", "e");
    

    This will correctly set the theme on either the li element for the left-side buttons or the a element for the right-side buttons, which ultimately has the effect of applying the new theme to the clicked element, which seems to be your goal.

    As for the TypeError that you were seeing, I think it is related to your .button() calls. The elements in jQuery Mobile listviews aren’t typically dealt with as buttons, so such calls may cause problems. All calls like .trigger('create') should be made at the listview level.


    In response to your edit, you must manually add and remove the classes to successfully toggle the theme. Otherwise, the classes for the old theme will still be present. For example, if you switch from theme e to c, the ui-btn-up-e or ui-btn-hover-e will still be on the li element, so it will appear to not toggle back to theme c. You can see this in action here: http://jsfiddle.net/wu86C/.

    The most important code is the second line here (and the equivalent for toggling from c to e):

    var li = $(this).closest('li');
    li.removeClass("ui-btn-up-e ui-btn-hover-e").addClass("ui-btn-hover-c");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

http://jsfiddle.net/nicktheandroid/BcaW3/1/ I'm trying to create a simple canvas version of my jQuery example. When
When I try to run this code, I get incorrect maximums and minimums. Could
I could not find a clear answer to this question elsewhere, so I'll try
Going back to an example I had previously asked about, I'll try and make
I've been looking into Java reflections. This is an example from Wikipedia http://en.wikipedia.org/wiki/Reflection_(computer_programming ):
I'm going to provide a simple example of what I'm trying to do --
I need to do simple http post in my app. Found example and created
So I searched and couldn't find anyone else having this problem: When I try
I could try to post and explain the exact query I'm trying to run,
When I try to run rails server on a new project it returns Could

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.