Sunday, 13 January 2013

JQuery Interview Questions

What is jQuery?
JQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, animating, event handling, and AJAX interactions for rapid web development.
JQuery is designed to change the way that you write JavaScript. Jquery is built library for JavaScript, no need to write your own functions or script, jquery all ready done for you.

Difference between onload() and document.ready() function used in jQuery?
  • We can add more than one document.ready() function in a page.
  • We can have only one onload function.
  • Document.ready() function is called as soon as DOM is loaded.
  • body.onload() function is called when everything (DOM, images..) gets loaded on the page.

Is jQuery a library for client scripting or server scripting?
Client scripting

Is jQuery a W3C standard?
No

What are jQuery Selectors?
Selectors are used in jQuery to find out DOM elements. Selectors can find the elements via ID, CSS, Element name and hierarchical position of the element.

The jQuery html() method works for both HTML and XML documents?
It only works for HTML.

Which sign does jQuery use as a shortcut for jQuery?
$(dollar) sign

What does $("div") will select?
It will select the entire div element in the page.

What does $("div.parent") will select?
The entire div element with parent class.

What is the name of jQuery method used for an asynchronous HTTP request?
jQuery.ajax()

What are the different types of selectors in Jquery?
  1. CSS Selector
  2. XPath Selector
  3. Custom Selector

What does .size() method of jQuery return?   
.size() method of jQuery returns number of element in the object.

Explain the each() function.
$("#num").click(function(){
$("li").each(function(){
document.write($(this).text())
});
});

1 comment:

  1. Different types of selectors: The answer could be tag selector $('#div'), ID selector.
    Better ask the interviewer about the context of question. Some more questions from my side:
    jQuery interview questions

    ReplyDelete