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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:33:02+00:00 2026-05-22T22:33:02+00:00

I am currently using jQuery Mobile on a project and have run into a

  • 0

I am currently using jQuery Mobile on a project and have run into a funny little quirk.

We have a screen where multiple buttons are used to toggle what information is displayed (basically, buttons are being used as radio buttons). We have added click handlers to the buttons that look something like this:

// This is all grossly oversimplified, of course.
function callService() {
  service.sendRequest()
    .success(function(response) {
      displayResponse(response);
      $('#button-id').addClass('highlighted')
    })
    .error(function(response) {
      displayErrors(response.errors);
    });
}

$('#button-id').click(function() {
  callService();
});

As you can perhaps see or at least guess, the above code makes an asynchronous service call when the button is clicked. When the service returns a response, the screen is updated and the button is supposed to be highlighted.

What’s happening is this: when we set our mock server (a server set up for local testing that just returns dummy data) to have a delay of 0 ms, the button doesn’t get highlighted. It seems that the highlighting is applied, but then immediately removed by jQuery as it does some styling of its own to deal with the clicking (i.e., updating the style on hover, on click, and then on release).

When we set the delay to something more realistic, or even as low as 250 ms (not going to happen given the actual back-end services used by this app), the problem goes away. My best guess is that jQuery finishes with all its style updates within that time window, so when the service finally does return a response the update to the button is no longer overwritten.

In reality, this isn’t much of an issue since the services used in production will have a delay time of something closer to 1-2 s. I’m just curious if there is any way to deal with this the “right” way; e.g., is it possible to write code that will run guaranteed after jQuery has finished with its multiple style updates to an element?

  • 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-22T22:33:03+00:00Added an answer on May 22, 2026 at 10:33 pm

    Simply use your own class and override any styles jQuery applies. Something like http://jsfiddle.net/morrison/cj8ra/.

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

Sidebar

Related Questions

I am currently developing a mobile site using jQuery mobile. I have one simple
I'm currently writing a mobile app (hopefully iOS or android) using the jquery mobile
I'm currently using jQuery.validate as a plugin for validation... my problem comes into play
I am developing the application using jQuery Mobile 4.1. In my app, I have
I'm currently using jQuery on some radio buttons. When the user clicks a radio,
I'm currently using jQuery and am looking for a way to slide an image
I am currently testing this in Mozilla FireFox 3.0.5 using FireBug 1.3.0 with jQuery
Currently using System.Web.UI.WebControls.FileUpload wrapped in our own control. We have licenses for Telerik. I
I'm currently using VS2005 Profesional and .NET 2.0, and since our project is rather
I am currently using Windows Server 2008 Standard and have several Hyper V machines.

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.