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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:51:57+00:00 2026-05-26T12:51:57+00:00

I wrote a jQuery script (below) and I used the (document).ready(function($)) function does it

  • 0

I wrote a jQuery script (below) and I used the (document).ready(function($)) function
does it slow down the website, and if it does than can you please show me a way to create such functions without slowing down the site?
Thank you very much!

<script>
jQuery(document).ready(function($){ 
    $('#columns').wrapInner('<div id="columnsInner" />');
    $("div.productInfo:first").wrap("<div id='productDetails' />"); 
});
</script>
  • 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-26T12:51:58+00:00Added an answer on May 26, 2026 at 12:51 pm

    Simply using ready will not have a significant performance impact. A bigger issue is which selectors you use. For instance, “div.productInfo:first” should be fine on modern browsers with querySelector. However, on older browsers it may have to loop over divs until it finds a match. You could avoid that if that div had an id. I’m not necessarily advocating that; it’s just a general consideration.

    EDIT: Actually, I believe jQuery will not leverage querySelector(All), since it notes:

    Because :first is a jQuery extension and not part of the CSS
    specification, queries using :first cannot take advantage of the
    performance boost provided by the native DOM querySelectorAll()
    method. To achieve the best performance when using :first to select
    elements, first select the elements using a pure CSS selector, then
    use .filter(“:first”).”

    So even for newer browsers, it would be better to use:

    $("div.productInfo").filter(":first")
    

    jQuery would still have to loop over the divs in older browsers.

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

Sidebar

Related Questions

$(function(){ $('a').each(function(){ var x=this.href; this.href=www.somesitename.com/filter+this.href; }); }); i wrote the above jQuery script to
I'm learning JQuery and I wrote a simple AJAX external script for my homepage
I can't get the jquery selector in my javascript below to work in Safari
I wrote this jQuery script. It works somewhat OK. I want this fly out
I want to include jquery.js in myjs.js file. I wrote the code below for
I want to use jQuery.getJSON function in ASP.NET MVC 3.0, so I wrote the
I am trying to write a simple piece of Jquery in which the script
I wrote a jQuery plugin that binds to 8 elements on a page, and
before this I wrote all jquery-code into main fail. Now I want to move
I'm working with the jQuery Validation plugin and I wrote the following code which

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.