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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T13:59:11+00:00 2026-05-12T13:59:11+00:00

Walter Rumsby provided a great answer to Where to place JavaScript in an HTML

  • 0

Walter Rumsby provided a great answer to Where to place JavaScript in an HTML file. He references the work done by the Yahoo Exceptional Performance team and their recommendation to place scripts at the bottom of the page. Which is a hard and fast rule that I’ve been following for quite sometime now. In the same thread Levi Rosol pointed out “the best place for it [JavaScript] is just before you need it an no sooner.” That is the predicament that I now find myself in.

I’ve added my reference to jQuery at the end of my page but have run into an issue with how to structure a user control that I’d like to add client side functionality to. Specifically, I am having a hard time working out the best way to accommodate dependencies. The user control has a span tag containing a numeric value that I’d like to update based on the number of check boxes the user has checked in the user control. I am using jQuery to find the span tag and update its text property.

Unfortunately, unless my reference to jQuery appears prior to the user control I receive JavaScript errors. This makes sense because the control is referencing functions that have not yet been added. I can think of several solutions to the issue but am looking for a best practice option.

  1. Placing a reference to the jQuery library inside of the user control.
    • Downside: if the user control was placed into a repeater multiple references to the jQuery library would be made.
  2. Put no JavaScript in the user control and write all code to update the span tag for the user control in the containing page.
    • Downside: I’d end up with the same code in multiple places creating a potential maintenance nightmare.
  3. Place the jQuery reference in the head section of the page.
    • Downside: I’ve violated the recommendation to place scripts at the bottom of the page and have created an unusable user control if the page does not include a reference to jQuery.

Those are the options and downsides I came up with when thinking about solutions to this problem. I am certainly open to suggestions for better solutions and barring none looking for a recommendation of which of the three I should choose.

  • 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-12T13:59:11+00:00Added an answer on May 12, 2026 at 1:59 pm

    Another option would be to dynamically generate the script reference by registering a startup script from your usercontrol that wrote a script reference to the document head.

    The javascript function could check for an existing jQuery reference, and if none was found, write the reference out. This would solve the multiple references. A basic example was discussed in this thread.

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

Sidebar

Ask A Question

Stats

  • Questions 192k
  • Answers 192k
  • 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 I've used Symantec Scan engine (http://www.symantec.com/business/scan-engine) with some success calling… May 12, 2026 at 6:26 pm
  • Editorial Team
    Editorial Team added an answer The GIL is indeed per-process, not per-interpreter. This is unchanged… May 12, 2026 at 6:26 pm
  • Editorial Team
    Editorial Team added an answer __FILE__ is the name of "this" file, even if it… May 12, 2026 at 6:26 pm

Related Questions

I am trying to build a Google Maps-driven web application that can display a
I want to display a menu on every page that is run from a
Scenario: A user enters a string in the DateTime field. A * appears when
Is it possible to set environmental variables in a build profile as opposed to
I am trying to write a custom tag. I can write attributes; however, I'm

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.