About jQuery

25 Sep

jQuery questions


What is jQuery?

jQuery is a lightweight JavaScript library that emphasizes interaction between JavaScript and HTML.
jQuery is a JavaScript Library.
jQuery greatly simplifies JavaScript programming.

Advantages of jQuery :

Ease of use
Large library
Ajax support
Great documentation and tutorials
Strong opensource community. (Several jQuery plugins available)
JavaScript enhancement without the overhead of learning new syntax
Ability to keep the code simple, clear, readable and reusable

jQuery Syntax


A $ sign to define/access jQuery
A (selector) to “query (or find)” HTML elements
A jQuery action() to be performed on the element(s)


$(this).hide() – hides the current element.
$(“p”).hide() – hides all <p> elements.


1.Is jQuery a library for client scripting or server scripting?
Ans: Client scripting

2.Is jQuery a W3C standard?
Ans: No

(Note:W3C standards define an Open Web Platform for application development that has the unprecedented potential to enable developers to build rich interactive experiences, powered by vast data stores, that are available on any device.)

3.What are jQuery Selectors?
Ans: 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.

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

5.What is the difference between HTML and XML?

XML was designed to describe data and to focus on what data is.
HTML was designed to display data and to focus on how data looks.

HTML is about displaying information.
XML is about describing information.

6.Difference between $(this) and ‘this’ in jQuery?
this and $(this) refers to the same element.
when ‘this’ is wrapped in $() ( ex:($(this).text()); ) then it becomes a jQuery object and you are able to use the power of jQuery.

7.Which sign does jQuery use as a shortcut for jQuery?
Ans: $(dollar) sign.

8.What does $(“div”) will select?
Ans: It will select all the div element in the page.

9.What does $(“div.parent”) will select?
Ans: All the div element with parent class.

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

11.What is jQuery Selectors? Give some examples.

jQuery Selectors are used to select one or a group of HTML elements from your web page.
jQuery support all the CSS selectors as well as many additional custom selectors.
jQuery selectors always start with dollar sign and parentheses: $()
There are three building blocks to select the elements in a web document.

1) Select elements by tag name

Example: $(div)
It will select all the div elements in the document.

2) Select elements by ID

Example: $(#select”)
It will select single element that has an ID of select

3) Select elements by class
Example: $(“.helloclass”)
It will select all the elements having class helloclass

12.What is .siblings() method in jQuery?

We filter the elements fetched by an optional selector.

<p>Hello Again</p>
<p>And Again</p>
<script>$(“p”).siblings(“.selected”).css(“background”, “yellow”);</script>


Referred by :




Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: