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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T19:36:35+00:00 2026-05-14T19:36:35+00:00

I’ve got a script that disables a button input control, empties a table body

  • 0

I’ve got a script that disables a button input control, empties a table body and then (after an AJAX call) re-populates it. It all works fine but sometimes there are a lot of rows in the table so the browser (IE) takes a while to empty and refill it. The strange thing is, while the rows are being emptied, the button still appears to be enabled, however if I put an alert between the button being disabled and the tbody being emptied, the button works properly, disabling visibly before the the alert comes up. Is there any way I can get the button to update before the resource consuming table emptying process/command commences?
Thx
MH

Code sample, as requested (but it’s not complex, so I didn’t initially include it)

$('#Search').attr('disabled', true);
$('#StatusSpan').empty();
$('#DisplayTBody').empty();

then I perform my AJAX call, re-enable the button and repopulate the table – if you attach that bit of code to a button and pop a 1500 line table.

As I mentioned, normally this is really quick and isn’t a problem, but if there are, say, 1500 rows in the table it takes a while to clear down but the ‘Search’ button doesn’t update on the screen, however if I put an alert after the .attr(‘disabled’ line the button visibly updates when the alert box is up, but without that the button doesn’t visibly disable until after the table clears (which is about 3 or 4 seconds with 1500 rows), it just stays in it’s down/”mid-press” state. I don’t have a problem with the time the browser is taking to render the table changes, that’s just life, but I need the users to see visible feedback so they know the search has started.

——further edit
Here’s some code that can reproduce the problem.

<input id="Search" type="button" value="Search" />
<table>
    <tbody id="DisplayTBody">
        <tr>
            <td>Data</td><td>Data</td><td>Data</td><td>Data</td>
        </tr>
    </tbody>
</table>

copy the table row until you have 1500 rows, then this is the script

<script type="text/javascript">
    $(document).ready(function() {
        $('#Search').click(function() {
            $('#Search').attr('disabled', true);
            //alert('l');
            $('#DisplayTBody').empty();
        });
    });
</script>

If you uncomment the alert, you should be able to see the problem. This occurs in both IE8 and FF, but my main problem is with IE8. In that example, as the table is quite simple, it doesn’t take long to clear the rows, but with a more complex table it takes longer and so the issue is more apparent.

  • 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-14T19:36:36+00:00Added an answer on May 14, 2026 at 7:36 pm

    Maybe this will do it?

    $('#Search').attr('disabled', true);
    setTimeout( function(){
        $('#StatusSpan').empty();
        $('#DisplayTBody').empty();
    }, 100); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 381k
  • Answers 381k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The problem is with your URL - you havent encoded… May 14, 2026 at 10:09 pm
  • Editorial Team
    Editorial Team added an answer How would a client which is another program authenticate through… May 14, 2026 at 10:09 pm
  • Editorial Team
    Editorial Team added an answer You might have better luck setting the max value for… May 14, 2026 at 10:09 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.