Home / Interview / JQuery :: General Questions

Interview :: JQuery

21) What is a CDN?

CDN stands for Content Delivery Network or Content Distribution Network. It is a large distributed system of servers deployed in multiple data centers across the internet. It provides the files from servers at a higher bandwidth that leads to faster loading time. These are several companies that provide free public CDNs:

  • Google
  • Microsoft
  • Yahoo
22) What is the goal of CDN and what are the advantages of using CDN?

The primary 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 regularly visits a site which is using jQuery framework from any of these CDN, it will be cached.
23) How can you use a jQuery library in your project?

You can use a jQuery library in the 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.

24) What are the 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 find the HTML elements in jQuery. There are many types of selectors. Some basic selectors are:

  • Name: It is used to select all elements which match with the given element Name.
  • #ID: It is used to select a single element which matches with the given ID
  • .Class: It is used to select all elements which match with the given Class.
  • Universal (*): It is used to select 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.
25) What is a use of jQuery filter?

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

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

There are three types of selectors in jQuery:

  • CSS Selector
  • Custom Selector
  • XPath Selector
27) What is the difference between the ID selector and class selector in jQuery?

ID selector and class selector are the same as they are in CSS. ID selector uses ID while class selector uses a class to select elements.

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

28)

What is the use of serialize() method in JQuery?

The jQuery serialize() method is used to create a text string in standard URL-encoded notation. It serializes the form values so that its serialized values can be used in the URL query string while making an AJAX request.

Syntax:

For complete example:

 

29) What is the use of val() method in JQuery?

The jQuery val() method is used:

  • To get the current value of the first element in the set of matched elements.
  • To set the value of every matched element.

Syntax:

For complete example: "

30) 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.

CSS addClass() Example

CSS removeClass() Example