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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T01:13:41+00:00 2026-06-17T01:13:41+00:00

I’m almost new to web developing and I’m facing to Javascript/jQuery. I would like

  • 0

I’m almost new to web developing and I’m facing to Javascript/jQuery. I would like to understand how a script is executed in an html page. I’m a C/Java programmer and references to these languages could help me.
I understood that a script can be inserted in the header or at the end of the body if we want to execute it after the page is loaded. I know that a function can be called by a DOM event (I associate events to interrupt signals). What I would like to know is if a script like this:

<script type="text/javascript">
//<![CDATA[
var i=10;
if (i<5)
  {
  // some code
  }
//]]>
</script>

in the body or in the head element is executed only once or is executed continuously. Does jQuery behave in the same way as Javascript?
What about plugins? Do they live for all the time a page is shown (like a parallel thread) or are they event driven (they are called by clicking/resizing etc or using timers)?
I know that is a very general question and that probably it cannot be explained in a few lines but some basic explanation and a link to some documentation would be very appreciated.

Thank you!

  • 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-17T01:13:42+00:00Added an answer on June 17, 2026 at 1:13 am

    jQuery is just a library written in JavaScript that mainly simplifies DOM manipulation and working with AJAX requests. If you want to understand how JS works, forget about jQuery for a moment.

    Regarding script execution: The browser parses the HTML and creates a DOM out of it. When the browser encounters a <script> tag and its content, it creates a DOM element for it, adds it to the tree and executes the code. Then it continues parsing the next tag, which implies that the code is only executed once.
    The reason for executing the script during parsing is that the script can already manipulate the HTML right away (using, e.g. document.write (not good practice though)) and therefore change what the parser has to parse. Script execution can be deferred using the defer attribute, until the document is fully parsed (I haven’t seen the attribute very often in live code until now though).

    All script tags share the same scope, the global scope and the execution environment persists until you navigate away or reload the page. So, defining a variable in one script and accessing it in the other is perfectly valid and in fact is what you are doing when you include libraries like jQuery in your page.

    <script>
        var foo = 'bar';
    </script>
    <!-- other HTML code -->
    <script>
        alert(foo);
    </script>
    

    You might find the HTML documentation about scripts helpful.

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

Sidebar

Related Questions

I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a small JavaScript validation script that validates inputs based on Regex. I
I am trying to render a haml file in a javascript response like so:
I would like to run a str_replace or preg_replace which looks for certain words
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
Is it possible to replace javascript w/ HTML if JavaScript is not enabled on
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I would like to count the length of a string with PHP. The string

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.