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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T22:51:05+00:00 2026-06-18T22:51:05+00:00

For example, bootstrap put the jQuery at the end of the html, e.g. http://twitter.github.com/bootstrap/examples/starter-template.html

  • 0

For example, bootstrap put the jQuery at the end of the html, e.g. http://twitter.github.com/bootstrap/examples/starter-template.html

What if, you want to insert a code block before the loading of jQuery script itself, e.g.

<div id="test1"></div> 
<div id="test2"></div> 

<script>
   $(document).ready(function() {
     $('#test1').html('test1'); // not work, any workaround? the code must be put before..
   });
</script> 

<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script>
   $(document).ready(function() {
     $('#test2').html('test2'); // work
   });
</script>   

Test: http://jsfiddle.net/e5HKZ/

I want both test1 & test2 also displayed.

Any idea?

  • 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-06-18T22:51:06+00:00Added an answer on June 18, 2026 at 10:51 pm

    If you really have to put jQuery code before the line that loads jQuery itself, assign the function to document.ready.

    window.document.ready = function() {
        $('#test1').html('test1');
    };
    

    When jQuery has been loaded, it reads the variable and executes the function at DOM ready.

    Note that this is most likely undocumented behavior and might not work reliably or in future jQuery versions.

    Demo: http://jsfiddle.net/e5HKZ/1/

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

Sidebar

Related Questions

I copied exactly the same code from official example http://twitter.github.com/bootstrap/examples/starter-template.html . But on my
For example http://twitter.github.com/bootstrap/base-css.html try to scroll up. You will see the bar with Typography
You can see here http://twitter.github.com/bootstrap/components.html#thumbnails in the example with a title and a description,
this is a code I found here http://www.w3resource.com/twitter-bootstrap/typehead.php <!DOCTYPE html> <html> <head> <meta charset=utf-8
Twitter Bootstrap Version: 2.0.3 Example HTML code: <!DOCTYPE html> <html dir=ltr lang=en-US xmlns:og=http://opengraphprotocol.org/schema/> <head>
Twitter Bootstrap Version: 2.0.3 Example HTML code: <!DOCTYPE html> <html dir=ltr lang=en-US xmlns:og=http://opengraphprotocol.org/schema/> <head>
Case with bootstrap: Example code function( $ ){ }( window.jQuery );
The canonical example for Twitter Bootstrap's popover feature is sort of a tooltip on
Is it possible to style default JS alerts using Twitter Bootstrap? For example: alert(You
I am working on the twitter bootstrap website using this example to develop my

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.