Jquery HelpDesk

JQuery Interview Questions


jQuery is a fast and concise JavaScript Library created by John Resig in 2006 with a nice motto - Write less, do more. jQuery simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is a JavaScript toolkit designed to simplify various tasks by writing less code.

Used to develop browser compatible web applications Improve the performance of an application Very fast and extensible UI related functions are written in minimal lines of codes

Following are the core features of JQuery:

  • DOM manipulation − The jQuery made it easy to select DOM elements, traverse them and modifying their content by using cross-browser open source selector engine called Sizzle.
  • Event handling − The jQuery offers an elegant way to capture a wide variety of events, such as a user clicking on a link, without the need to clutter the HTML code itself with event handlers.
  • AJAX Support − The jQuery helps you a lot to develop a responsive and feature-rich site using AJAX technology.
  • Animations − The jQuery comes with plenty of built-in animation effects which you can use in your websites.
  • Lightweight − The jQuery is very lightweight library - about 19KB in size ( Minified and gzipped ).
  • Latest Technology − The jQuery supports CSS3 selectors and basic XPath syntax.

No, jQuery HTML only works for HTML documents not for XML Documents.

Some of the effects methods are:

  • Show()
  • Hide()
  • Toggle()
  • FadeIn()
  • FadeOut()
  • slideDown()

Efficiency of web page increases when minimized version of jQuery is used.min.js file will be more than 50% less than the normal js file. Reduction in the file size makes the web page faster.

Use $(document).ready() function. Everything inside it will load as soon as the DOM is loaded and before the page contents are loaded.

jQuery is a library of JavaScript file and it consists of DOM, event effects and the Ajax functions. jQuery is said to be a single JavaScript file.

Mac, Windows and Linux are more compatible with the jQuery.

The command $.ui.version returns jQuery UI version.

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

A ‘ jQuery connect’ is a plugin used to connect or bind a function with another function. Connect is used to execute function from any other function or plugin is executed.

Connect can be used by downloading jQuery connect file from jQuery.com and then include that file in the HTML file. Use $.connect function to connect a function to another function.

Browser compatibility of jQuery plugin is an issue and needs lot of time to fix it.

Following are the basic selectors in jQuery:

  • Element ID
  • CSS Name
  • Tag Name
  • DOM hierarchy

Yes, we can call C# code from jQuery as it supports .net application.

jQuery.data methods is used to associate the data with the DOM nodes and the objects. This data method makes the jQuery code clear and concise.

Each function is used to iterate each and every element of an object. It is used to loop DOM elements, arrays and the object properties.

Size and length both returns the number of element in an object. But length is faster than the size because length is a property and size is a method.

jQuery load method is a powerful AJAX method which is used to load the data from a server and assign the data into the element without loading the page.

Yes, We can use our own variable in place of $ by using the method called no Conflict () method.

var sample = $.noConflict()

The four parameters are:-

  • URL – Need to specify the URL to send the request
  • type – Specifies type of request(Get or Post)
  • data – Specifies data to be sent to server
  • Cache – Whether the browser should cache the requested page

The jQuery filter is used to filter the certain values from the object list based on the criteria. Example is to filter certain products from the master list of products in a cart website.

CDN is abbreviated as Content Distribution network and it is said to be a group of companies in different location with network containing copies of data files to maximize bandwidth in accessing the data.

There are two types of CDNs:

  • Microsoft – Load jQuery from Ajax CDN
  • Google – Load jQuery from Google libraries API

jQuery is a client scripting.

jQuery is a Javascript file and it is single javascript file that contains common DOM, event effects and Ajax functions.

There are two ways to debug jQuery:

Debugger keyword

  • Add the debugger to the line from where we have to start debugging and then run Visual Studio in Debug mode with F5 function key.
  • Insert a break point after attaching the process

Following are the ways to include jQuery in a page:

  • Local copy inside script tag
  • Remote copy of jQuery.com
  • Remote copy of Ajax API
  • Local copy of script manager control
  • Embedded script using client script object

jQuery.ajax method is used for asynchronous HTTP requests.

jQuery javascript can be downloaded from jQuery official website – www.jquery.com

No, jQuery is not a replacement of JavaScript.

Chaining is used to connect multiple events and functions in a selector.

Following are the advantages of jQuery:

  • Just a JavaScript enhancement
  • Coding is simple, clear, reusable
  • Removal of writing more complex conditions and loops

Yes, we can call C# code behind from jQuery.

jQuery data method is used to associate data with DOM nodes and JavaScript objects. This method will make a code very concise and neat.

In a page, we can have only one onload function but we can have more than one document.ready function. Document.ready function is called when DOM is loaded but onload function is called when DOM and images are loaded on the page.

jQuery each function is used to loop through each and every element of the target jQuery object. It is also useful for multi element DOM, looping arrays and object properties.

$.ajax can be called and by declaring WebMethod inside code behind using jQuery.

ID and Element are the fastest selectors in jQuery.

Class selectors are the slowest selectors in jQuery.

jQuery code is getting executed on a client browser.

jQuery is a library used for developing Ajax application and it helps to write the code clean and concise. It also handles events, animation and Ajax support applications.

There are three types of selectors in jQuery:

  • CSS Selector
  • XPath Selector
  • Custom Selector