New jQuery Interview Questions and Answers for beginners



Why do we use jQuery?
Because giving following advantages.
  • Capable for AJAX
  • Easily expandable
  • Easy to use and understand.
  • Cross-browser supported such as IE6.0+, FF1.5+, Safari 2.0+, and Opera 9.0+
  • Easy to use for traversal and DOM manipulation
  • Large pool with built in methods
  • This methods provide for changing or applying CSS and creating animations
  • Handling and event detection
  • Tons of plug-ins for all types of needs
What are the difference between jQuery and JavaScript?
The JavaScript is a language and jQuery is a library include in the JavaScript language that helps to use the JavaScript language.
IS jQuery replacement of Javascript?
The jQuery is not a replacement of JavaScript. jQuery is a different library which is on top of JavaScript. And jQuery is a lightweight JavaScript library that provides interaction between HTML and JavaScript.
Is jQuery a W3C standard?
The jQuery is not a W3C standard.
What is the principle need to begin with jQuery?
To begin with jQuery, first need to make reference of its library. The popular version of jQuery can be downloaded from this website jQuery.com.
What is the beginning point of code execution in jQuery?
The beginning point of jQuery code execution is $(document).ready () function which is executed when the DOM is loaded.
What do you mean by jQuery.noConflict?
As different client side libraries such as MooTools, the Prototype can be utilized with jQuery and they also use $0 as their global function and to declare variables. In this situation creates conflict as $() is utilized by jQuery and other library as their global function. To affect from this situations jQuery has recognized jQuery.noConflict().
Example
jQuery.noConflict();
// Use jQuery via jQuery(MerajAnsari)
jQuery(document).ready(function(){
jQuery("div").hide();
});
You can also write own specific character in the place of $ sign in jQuery.
var $meraj = jQuery.noConflict();
// Use jQuery via jQuery(...)
$meraj(document).ready(function(){
$meraj("div").hide();
});
What do you mean by fastest selectors in jQuery?
Element and ID selectors are the fastest selectors in jQuery.
What do you mean by slow selectors in jQuery?
The class selectors are the slow compare to element and ID.
What is the difference between get () and eq() methods in jQuery?
In get () return a DOM element. The method receives the DOM elements matched by the jQuery object. But the DOM element and it is not a jQuery wrapped object. So the jQuery function cannot be used.
In eq() return the element as a jQuery object. In these method constructors a new jQuery object from one element within that returns and set it. So you can use the jQuery function on it.
Which operating system (OS) is more compatible with jQuery?
There are following operating system is compatible with jQuery:
  • Windows
  • Mac
  • Linux
Which command will provide version of jQuery?
The $.ui.version returns jQuery UI version.
What do you mean by jQuery connect?
The jQuery connect is a plugin used to connect or bind a function with another function. Connect is used to execute function any other function and plugin is executed.
What are the browser related problems for jQuery?
The browser compatibility of jQuery plugin is a problem and needs lot of time to fix it.
Which are the four parameters used for the jquery Ajax method?
The following four parameters used for the jQuery Ajax method are:
  • URL (Universal Resource Location)- Need to define the URL to send the request
  • type- Define the type of request such as Get and Post
  • data- Define data to be sent to the server
  • Cache- If the browser should cache the requested page
What is used to for testing jQuery?
The QUnit is used to test jQuery and it is very easy and important.
How to provide the server response from an Ajax request using jQuery?
First of all when invoking functions that have non parallel behavior we must give a callback function to capture the actual result. This is important with Ajax in the browser because when a remote request is made, it is indeterminate when the result will be received.
Example
$.ajax({
url: 'pcdsEmpRecords.php',
success: function(response) {
alert(response);
},
error: function(xhr) {
alert('Error!  Status = ' + xhr.status);
}
});
Why is hide an icon on a button click using jQuery?
The jQuery provides better support for handling events such as a button click. This code is used to hide an image, found using class or ID. If you need to know how to use the hide () method and how to setup an event handler for button, to handle clicks, you can use the following code:
$("#ButtonToClick").click(function(){
$("#ImageToHide").hide();
});
What is each () function in jQuery?
The each () function  provide you to iterate over a set of elements. You can use a function to each () method, which will be proceed for each element from the jQuery object on which it has been called.
$('[Meraj=MerajOfSelectedTag] :selected').each(function(selected){
alert($(selected).text());
});

No comments:

Post a Comment