You are including jQuery dynamically into the page, by either adding a <script>element to the DOM or doing it some other way like Ajax.Once jQuery is loaded, you expect everything to start working, but for some reason,no script starts.
You need to include an additional script to be executed after jQuery is loaded. This script will simply call jQuery.ready(). After you do this, everything will start working as expected.
What is jQuery.ready()?
The jQuery.ready() function is called by jQuery’s core when the document is detected as ready. Once called, all the document.ready handlers are triggered automatically.
Why was this happening?
The document.ready detection is mostly based on events. Depending on the browser, acertain event is bound, and it’s supposed to be triggered once the document is ready.
In addition, the window.onload event is bound for all browsers as a fallback measure incase the other options fail.
What was happening to you is that jQuery was finally loaded into the page only after the window.onload event; therefore, all the event handlers remained bound, and none got triggered.
By calling jQuery. ready(), you’re “announcing” the document. ready event manually, triggering all the handlers and getting things back to normal.
J Query Related Interview Questions
|HTML 4 Interview Questions||HTML Interview Questions|
|HTML 5 Interview Questions||Zend Interview Questions|
|JqueryUI Interview Questions||Dynamic HTML Interview Questions|
|XQuery Interview Questions||jQuery Mobile Interview Questions|
J Query Related Practice Tests
|HTML 4 Practice Tests||HTML Practice Tests|
|HTML 5 Practice Tests||Zend Practice Tests|
|PHP and Jquery Practice Tests||J Query Practice Tests|
|CodeIgniter Practice Tests||Dynamic HTML Practice Tests|
J Query Tutorial
Selecting Elements With Jquery
Beyond The Basics
Faster, Simpler, More Fun
Html Form Enhancements From Scratch
Html Form Enhancements With Plugins
Interface Components From Scratch
User Interfaces With Jquery Ui
Jquery Ui Theming
Jquery, Ajax, Data Formats: Html, Xml, Json, Jsonp
Using Jquery In Large Projects
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.