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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:59:46+00:00 2026-05-29T05:59:46+00:00

The common method of starting jQuery is putting it in $(document).ready(function() { // put

  • 0

The common method of starting jQuery is putting it in

$(document).ready(function() {
    // put all jQuery stuff here
});

But what if I have a complicated site which uses basic jQuery in <head> and some custom functions that depend on the page type (e.g. if I have login page, fire some login ajax stuff).

So, how can I attach code to $(document).ready() or fire it later? Which JS syntax should I use?

Thanks for help!


My page structire is similar to this:

  1. Display static header using PHP’s include()
  2. Add content inside <body></body>
  3. Display the template footer

<?php

include_once('system/classes/class.display.php');

$d = new IFDisplay();

$d->display_header(array('subtitle' => 'Log In')); <-- Here it displays static
                                                       head tags. There is
                                                       document.ready in there.
                                                       I can't change it.

?>

<script type="text/javascript">
AND WHAT DO I NEED TO PUT HERE
</script>

<div>...</div>

<?php

$d->display_footer();

?>
  • 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-29T05:59:47+00:00Added an answer on May 29, 2026 at 5:59 am

    If you aren’t worried about race conditions, you should be able to use this:

    $(function(){
        //put your code here
    });
    

    As many times as you like.

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

Sidebar

Related Questions

I have a common method among multiple controllers, not all. Is correct to put
If I have a method for calculating the greatest common divisor of two integers
Evening, Is there a common or standardised name given to a function or method
Let's say I have a common method which creates a DB connection: Connection getConnection()
The most common method for corrupting compressed files is to inadvertently do an ASCII-mode
It seems that the following is a common method given in many tutorials on
The listFiles() method of org.apache.commons.net.ftp.FTPClient works fine with Filezilla server on 127.0.0.1 but returns
I hate starting a post with this but I'm new to Java... I've followed
As we all know most apps have a data access layer, often using repository
I am having an issue with a string manipulation method I have written. The

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.