Register Login

jQuery Interview Questions

jQuery Interview FAQ's

1. What is jQuery?

A: jQuery is not a programming language, but a cross browser JavaScript Library. It is a feature rich, fast, and lightweight client side framework that helps in document traversing, AJAX interactions, event handling, and making animations.

2. Why is jQuery used?

A: jQuery is used as JavaScript Library because it has a great number of advantages.

  • It is easy to learn and use, and can be expanded easily.
  • It is used to develop applications compatible with a browser, while also having cross browser support.
  • It has a large collection of built-in methods.
  • It has ways to create animations, and to apply or change CSS.
  • It makes DOM traversal and manipulation very easy.
  • It has AJAX handling ability.
  • It detects and handles events.
  • It has a massive collection of plugins for a wide variety of activities.

3. What is the difference between jQuery and JavaScript?

A: JavaScript is a programming language, and jQuery is a library built into JavaScript. It helps in the interaction between JavaScript and HTML codes.

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.

6. Can jQuery work with other JavaScript libraries?

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:

  • Name: Elements with the same given name are selected.
  • ID: A single element matching the given ID is selected.
  • Class: All elements with the given class name are selected.
  • Universal: All elements available in the DOM are selected.
  • Multiple Elements: The combined results of specified selectors are selected.
  • Attribute Selector: Elements are selected on the basis of their attribute values.

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?

A: DOM or Document Object Model is a method of representation and interaction with an HTML, XHTML, or XML documents. It allows navigation through and manipulation of such documents using JavaScript programming language.

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?

A: AJAX stands for Asynchronous JavaScript and XML. AJAX helps in loading server data without refreshing the browser page.

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:

  • URL: To specify the request URL
  • type: To specify the type of request
  • data: To specify the data that has to be sent to the server
  • Cache: To specify if the browser needs to make a cache of the page requested

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.


×