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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:27:35+00:00 2026-05-23T12:27:35+00:00

I have a block of code that generally works fine except when big lumps

  • 0

I have a block of code that generally works fine except when big lumps of data comes to the document then I get the error mentioned on the title.

I was attaching the click event to each element as you could see on the commented lines, but then I changed all to live as I though it was more effective. Despite the improvement on speed it would still come up with the alert twice asking me to stop the script, before rendering the entire page.

I wonder if there is any possible way of improve the performance on the following block of code (script) so the alert message does not come up when big amount of date its send to this particular page.

NOTE:I reduced the amount of code shown before as there were repeated code. this two left are giving a good example of the functions giving me a problem.

$(document).ready(function () {

//This adds the click event to toggle the next div right under the divLink clicked. 
//Old Code $(".divLink").click(function () { $(this).next('div').slideToggle(); });
$(".divLink").live('click', function (e) { $(this).next('div').slideToggle(); });


//Distribution 
//$(".Distribution").click(function () { $(this).parents().nextAll(".divDistribution").slideToggle(); });
$(".Distribution").live('click',function (e) { $(this).parents().nextAll(".divDistribution").slideToggle(); });

});

Any Ideas an explanation would be very much appreciated.

Thanks in advance.

  • 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-23T12:27:35+00:00Added an answer on May 23, 2026 at 12:27 pm

    Eureka!!!

    I found why I was getting such a big performance issues using .live on my code.

    I first was having the problem mentioned on my question because I was using document.ready+ element.click() to selected elements so it was causing big performance issues to the point of bringing the alert “Stop running this script?“.

    Then I changed the element.click() for element.live(‘click’,function(){}) because the .live attach a handler to the event for all elements which match the current selector therefore it should a lot quicker but it wasn’t.

    The reason of the performance issues using .live was I left the statements using .live inside the document.ready(); and therefore it was waiting for the the page to be rendered to attach the handler to the even for all elements.

    The solution taking the .live out of the document.ready() as its not needed.

    The result The page rendering of the page is now lightening, no matter how big the document is.

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

Sidebar

Related Questions

I have a block of code that works and I wanted to ask what
I have a webview in my app that generally works fine for loading websites.
I have a block of code that basically intializes several classes, but they are
I have a block of code that is repeated within a DB2 stored procedure.
I have a block of code that serializes a type into a Html tag.
I have a block of JSP code that needs to be used in several
I have a small code block that should append text to the beg of
I have a submit button that is a block of HTML code because of
I have a code snippet written in PHP that pulls a block of text
If you have some blocks of code that you would like to prevent execution

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.