jQuery Questions

Education is not limited to just classrooms. It can be gained anytime, anywhere... - Ravi Ranjan (M.Tech-NIT)

jQuery Interview QuestionsjQuery Interview Question

A list of top frequently asked jQuery interview questions and answers are given below.

1) What is jQuery?

jQuery is a fast, lightweight, feature-rich client side JavaScript framework. It has provided a much needed boost to JavaScript. Before jQuery, JavaScript codes were lengthy and bigger, even for smaller functionality.

2) Is jQuery a programming language?

jQuery is not a programming language but a well written JavaScript code. It is used to traverse documents, event handling, Ajax interaction and Animation.

3) What is the difference between JavaScript and jQuery?

The simple difference is that JavaScript is a language while jQuery is a built-in library built of JavaScript. jQuery simplifies the use of JavaScript language.

4) Is jQuery replacement of JavaScript?

No, jQuery is not the replacement of JavaScript. jQuery is written on the top of JavaScript and it is a different library. jQuery is lightweight JavaScript library which is used to interact JavaScript and HTML.

5) Why do we use jQuery?

  • It is very easy to learn and use.
  • It is used to develop browser compatible web applications.
  • It improves the performance of an application.
  • It is very fast and extensible.
  • It facilitates you to write minimal lines of codes for UI related functions.
  • It provides a cross-browser support.

6) What are the effects methods used in jQuery?

These are some effects methods used in jQuery:

  • show()
  • hide()
  • toggle()
  • fadeIn()
  • fadeOut()

7) Is it possible that jQuery HTML work for both HTML and XML document?

No, jQuery HTML only works for HTML document. It doesn't work for XML documents.

8) What is $() in jQuery library?

The $() function is an alias of jQuery() function. It is used to wrap any object into jQuery object which later facilitates you to call various method defined jQuery object. You can pass a selector string to $() function and it will return jQuery object which contains an array of all matched DOM elements.

9) Is jQuery library used for server scripting or client scripting?

It is a library for client side Scripting.

10) Is jQuery a W3C standard?

No, jQuery is not a W3C standard.

11) What is the starting point of code execution in jQuery?

$(document).ready() function is the starting point of jQuery code. It is executed when DOM is loaded.

12) What is the basic requirement to start with the jQuery?

You need to make reference of its library to start with jQuery. You can download the latest version of jQuery from jQuery.com.

13) Can you use a special character in place of $ (dollar sign) in jQuery?


14) Can you use multiple document.ready() function on the same page?

Yes. You can use any number of document.ready() function on the same page.

15) What is the difference between find and children methods?

Find method is used to find all levels down the DOM tree while children method is used to find single level down the DOM tree.

16) What is a CDN?

CDN stands for Content Delivery Network or Content Distribution Network. It is a large distributed systems of servers deployed in multiple data centers across the internet.

17) What is the goal of CDN and what are the advantages of using CDN?

The main goal of the CDN is to provide content to the end-users with high availability and high performance.

Advantages of using CDN:

  • It reduces the load from the server.
  • It saves bandwidth. jQuery framework is loaded faster from these CDN.
  • If a user visits regularly a site which is using jQuery framework from any of these CDN, it will be cached.

18) How can you use jQuery library in your project?

You can use jQuery library in ASP.Net project from downloading the latest jQuery library from jQuery.com and include the references to the jQuery library file in your HTML/PHP/JSP/Aspx page.

  1. <script src="_scripts/jQuery-1.2.6.js" type="text/javascript"></script>   
  2. <script language="javascript">   
  3. $(document).ready(function() {   
  4. alert('test');   
  5. });   
  6. </script>  

19) What are selectors in jQuery? How many types of selectors in jQuery?

If you want to work with an element on the web page, first you need to find it. Selectors are used to find the HTML elements in jQuery. There are many types of selectors. Some basic selectors are:

  • Name: It is used to selects all elements which match with the given element Name.
  • #ID: It is used to selects a single element which matches with the given ID
  • .Class: It is used to selects all elements which match with the given Class.
  • Universal (*): It is used to selects all elements available in a DOM.
  • Multiple Elements E, F, G: It is used to selects the combined results of all the specified selectors E, F or G.
  • Attribute Selector: It is used to select elements based on its attribute value.

20) What is use of jQuery filter?

: jQuery filter is used to filter the certain values from the object. It filters the result of your original query into specific elements.

21) What are the different types of selectors in jQuery?

There are three types of selectors in jQuery:

  • CSS Selector
  • Custom Selector
  • XPath Selector

22) What is the difference between ID selector and class selector in jQuery?

ID selector and class selector are same like they are used in CSS. ID selector uses ID while class selector uses class to select elements.

If you need to select just one element, use ID selector. If you want to select a group of elements, having same CSS class, use class selector.

23) How to add and remove CSS classes to an element using jQuery?

You can use addclass() jQuery method to add CSS class to an element and removeclass() jQuery method to remove CSS class from an element.

24) Can you write a jQuery code to select all links inside the paragraph?

Yes. You can use <a> tag nested inside paragraph <p> tag to select all links.

25) What is the difference between prop and attr?

attr(): It gets the value of an attribute for the first element in the set of matched element.

prop(): it gets the value of a property for the first element in the set of matched elements. It is introduced in jQuery 1.6.

26) What are the two types of CDNs?

There are two types of CDN:

  • Microsoft: It loads jQuery from AJAX CDN.
  • Google: It loads jQuery from Google libraries API.

27) What is the use of animate function in jQuery?

The animate function is used to apply the custom animation effect to elements. Syntax:

  1. $(selector).animate({params}, [duration], [easing], [callback])  


  • "param" defines the CSS properties on which you want to apply the animation.
  • "duration" specify how long the animation will run. It can be one of following values : "slow", "fast", "normal" or milliseconds
  • "easing" is the string which specify the function for the transition.
  • "callback" is the function which we want to run once the animation effect is complete.

28) How can you disable jQuery animation?

By using jQuery property "jQuery.fx.off" and setting it to true, you can disable jQuery animation