Jquery Interview Questions and Answers for Freshers, Experienced

jQuery is not a programming language but a well written JavaScript code. It is a fast, lightweight, jQuery JavaScript code, which do document traversing, event handling, Ajax interactions and Animations.

jQuery is needed for the following list:-

  • • It is very easy to learn and use
  • • 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
  • • It provides a cross-browser support.

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.

Dollar Sign is nothing but it's an alias for JQuery.

jQuery no-conflict is an option given by jQuery to overcome the conflicts between the different js frameworks or libraries. When we use jQuery no-conflict mode, we are replacing the $ to a new variable and assigning to jQuery some other JavaScript libraries. Also use the $ (Which is the default reference of jQuery) as a function or variable name what jQuery has. And in our development life, we are not at all strict to only jQuery.

document.ready() function is different from body onload() function for 2 reasons.
  • 1. We can have more than one document.ready() function in a page where we can have only one body onload function.
  • 2. document.ready() function is called as soon as DOM is loaded where body.onload() function is called when everything gets loaded on the page that includes DOM, images and all associated resources of the page.

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

  • CDN stands for Content Delivery Network, it's a way to store data on servers around the world to deliver content faster then from a single location, i.e. your hosting server.
  • If you have users in Hong Kong, but your hosting server is in Dallas, the time it takes to get there will be really slow. However with a CDN in place your content will get served from an edge server closer to the end user which overall increases loading times.

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

JavaScript famous keyword this always refers to the current context.

A callback is a plain JavaScript function passed to some method as an argument or option. Some callbacks are just events, called to give the user a chance to react when a certain state is triggered.

  • 1. When we want to fetch siblings of every elements in the set of matched elements then we can use siblings() method.
  • 2. We filter the elements fetched by an optional selector.
  • 3. Syntax : .siblings([selector])
  • 4. "selector" is the selector expression which specify the matched elements
  • The bind() method will not attach events to those elements which are added after DOM is loaded while live() and delegate() methods attach events to the future elements also.
  • The difference between live() and delegate() methods is live() function will not work in chaining. It will work only on an selector or an element while delegate() method can work in chaining.
  • .empty() method is used to remove all the child elements from matched elements.
  • .remove() method is used to remove all the matched element. This method will remove all the jQuery data associated with the matched element.
  • .detach() method is same as .remove() method except that the .detach() method doesn’t remove jQuery data associated with the matched elements.
  • .remove() is faster than .empty() or .detach() method.
  • 1. In jQuery both prop() and attr() function is used to set/get the value of specified property of an element.
  • 2. The difference in both the function is that attr() returns the default value of the property while the prop() returns the current value of the property.

Stay Connected

Popular Posts

Get Latest Stuff Through Email

Who Should Read TechTrick?

All the tricks and tips that TechTrick provides only for educational purpose. If you choose to use the information in TechTrick to break into computer systems maliciously and without authorization, you are on your own. Neither I (TechTrick Admin) nor anyone else associated with TechTrick shall be liable. We are not responsibe for any issues that caused due to informations provided here. So, Try yourself and see the results. You are not losing anything by trying... We are humans, Mistakes are quite natural. Here on TechTrick also have many mistakes..