1. What is jQuery?
2. Why is jQuery used?
4. What are selectors?
A: Selectors are elements that perform the basic function of jQuery, which is to find and select an element in DOM. It is a construct which has a string parameter containing a CSS selector expression. It returns DOM elements on which an effect or style is applied.
5. How are selectors defined?
A: Selectors in jQuery are a $() construct. The starting function is a $(document).ready() function. The ‘$’ may be replaced with jQuery to make the starting code jQuery(document).ready(). It may also be replaced with any character of the programmer’s choice using a separate jQuery.noConflict() function.
A: Yes, jQuery can work with other libraries like Prototype, MooTools, etc.
7. What are the versions of jQuery?
A: The jQuery library is available in two versions:
1.Development version: The open source fully editable version.
2.Deployment version: The much smaller, compressed non editable version for final deployment.
8. What is CDN?
A: The Content Delivery Network, also called Content Distribution Network, is a large distribution of server systems spread in many data centers all over the world. In this network, a request originating at one terminal goes to the closest server.
9. Name some CDNs used for jQuery.
A: Three very popular CDNs for jquery are of Microsoft, Google, and jQuery.
10. Why are CDNs used?
A: Distribution networks give some great advantage when working with jQuery. It reduces server load and saves bandwidth as jQuery loads faster from CDNs. Upon visiting a site using jQuery library from any of the CDNs a cache is created.
11. Which are the selectors used in jQuery?
A: There are multiple types of selectors available in jQuery. The basic selectors include:
12. Which are the fastest and slowest selectors of jQuery?
A: ID and element selectors are the fastest, while class selectors are the slowest.
13. What is DOM?
14. How are find and children methods different?
A: The find method finds all the levels down a DOM tree, while children method finds a single level down the DOM tree.
15. What does ‘jQuery connect’ do?
A: jQuery connect is a plugin that connects or binds one function with another function so that they can be executed together even if defined separately.
16. What does jQuery.data() method do?
A: The jQuery.data() method associates data with objects and DOM nodes. It makes the code concise and clear.
17. What does ‘each’ function do?
A: The ‘each’ function iterates every element in an object. It loops through array, properties of the object, and DOM elements.
18. How are ‘size’ and ‘length’ different in jQuery?
A: ‘length’ is a property, and ‘size’ is a method. So while both ‘length’ and ‘size’ give the number of elements of an object, length is ‘faster’ than ‘size’.
19. What is AJAX?
20. What does jQuery load method do?
A: the jQuery load method uses AJAX to load server data and assign it to an element without loading the webpage.
21. What parameters are used in jQuery AJAX method?
A: Four parameters used are:
22. What is chaining?
A: Chaining is the process of connecting many functions and events of a selector.
23. Where is jQuery code executed?
A: jQuery is a client side scripting, which means it gets executed on the client’s browser.
24. Can multiple AJAX requests be run simultaneously?
A: Yes, multiple AJAX requests can be run simultaneously, and is desirable in case of asynchronous events as running a request after one is completed takes a longer time.
25. What does the finish() method do?
A: The finish() method in jQuery stops all the animations queued, and puts all CSS properties in their final values or end state.