jQuery Interview Question
A list of top frequently asked jQuery interview questions and answers are given below.
1) What is jQuery?
2) Is jQuery a programming language?
5) Why do we use jQuery?
6) What are the effects methods used in jQuery?
These are some effects methods used in jQuery:
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:
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.
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:
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:
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:
27) What is the use of animate function in jQuery?
The animate function is used to apply the custom animation effect to elements. Syntax:
28) How can you disable jQuery animation?
By using jQuery property "jQuery.fx.off" and setting it to true, you can disable jQuery animation.