Tuesday 14 February 2017

JQuery interview questions Part 2

1. Ques: How JavaScript and jQuery are different ?
Answer:
JavaScript is a script language.
jQuery not a language. jQuery is a open source library built in the JavaScript language.


2. Ques: What is chaining in jQuery ?
Answer:
Chaining means to connect multiple functions, events on  single selectors.
Chaining allows us to run multiple jQuery methods (on the same element) within a single statement.
Chaining is one of the most powerful feature of jQuery.
it Provides your code shorter and easy to manage for better performance.
e.x.
$(document).ready(function(){
    $('#dvCont').addClass('headertop');
    $('#dvCont').css('color', 'gray');
    $('#dvCont').fadeIn('slow');
});​

3. Ques: What are various methods to make ajax request in jQuery ?
Answer:
folowing are jquery metohd which use for to make ajax calls.
load() : Load a piece of html into a container DOM.
$.getJSON(): Load JSON with GET method.
$.getScript(): Load a JavaScript file.
$.get(): Use to make a GET call and play extensively with the response.
$.post(): Use to make a POST call and don't want to load the response to some container DOM.
$.ajax(): Use this to do something on XHR failures, or to specify ajax options (e.g. cache: true) on the fly.

4. Ques: What is the difference between jQuery and jQuery UI ?
Answer:
  • jQuery is the core library. It focuses on the low-level stuff like creating elements, manipulating the DOM, event handling, performing HTTP requests, etc
  • jQuery UI is a used for user interface effects, widgets, and themes built on top of the jQuery JavaScript Library. It is a set of user interface components like buttons, dialog boxes, sliders, tabs, more advanced animations, drag/drop functionality.If you use jQueryUI, you must also include jQuery.


No comments:

Post a Comment

Thank you for comment