1) What is jQuery?
JQuery is fast, lightweight and feature-rich
client-side JavaScript Library/Framework which helps in to traverse HTML DOM,
make animations, add Ajax interaction, manipulate the page content, change the
style and provide cool UI effect. It is one of the most popular client-side libraries
and as per a survey it runs on every second website.
jQuery is not a programming language but a
well written JavaScript code. It is a JavaScript code, which do document
traversing, event handling, Ajax interactions and Animations.
2) Why jQuery is needed?
jQuery is needed for the following list:
·
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.
3)
Why do we use JQuery?
Due to following advantages.
·
Easy to use and learn.
·
Easily expandable.
·
Cross-browser support (IE 6.0+, FF
1.5+, Safari 2.0+, Opera 9.0+)
·
Easy to use for DOM manipulation and
traversal.
·
Large pool of built in methods.
·
AJAX Capabilities.
·
Methods for changing or applying CSS,
creating animations.
·
Event detection and handling.
·
Tons of plug-ins for all kind of
needs.
4)
How JavaScript and JQuery are different?
JavaScript is a language while jQuery is a library
built in the JavaScript language that helps to use the JavaScript language.
5)
Is JQuery replacement of Java Script?
No. JQuery is not a replacement
of JavaScript. JQuery is a different library which is written on top of
JavaScript. JQuery is a lightweight JavaScript library that emphasizes
interaction between JavaScript and HTML.
6) Whether jQuery HTML
work for both HTML and XML documents?
No, jQuery HTML only works for HTML documents
not for XML Documents.
7) What are the methods
used to provide effects?
Some of the effects methods are:
·
Show()
·
Hide()
·
Toggle()
·
FadeIn()
and
·
FadeOut()
8) What is the advantage
of using minimized version of jQuery?
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.
9) Is jQuery is a
JavaScript or JSON library file?
jQuery is a library of JavaScript file and it
consists of DOM, event effects and the Ajax functions. jQuery is said to be a
single JavaScript file.
10) Which operating
system is more compatible with jQuery?
Mac, Windows and Linux are more compatible
with the jQuery.
11) How can we include
jQuery library in ASP.Net project?
Download the jQuery library from jQuery.com
and include that reference in the asp.net page.
12) Which command will
give a version of jQuery?
The command $.ui.version returns jQuery UI
version.
13) In what scenarios
jQuery can be used?
jQuery can be used in following scenarios:
·
Apply
CSS static or dynamic.
·
Calling
functions on events.
·
Manipulation
purpose.
·
Mainly
for Animation effects.
14) What is the
difference between find and children methods?
Find method is used to find all levels down
the DOM tree but children find single level down the DOM tree.
15) What is jQuery
connect?
A ‘jQuery connect’ is a plugin used to
connect or bind a function with another
function. Connect is used to execute function from any other function or
plugin is executed.
16) How to use connect?
Connect can be used by downloading jQuery
connect file from jQuery.com and then include that file in the HTML file. Use
$.connect function to connect a function to another function.
17) What are the features
of jQuery, has been used in web applications?
jQuery uses features like Sliding, File
uploading and accordian in web applications.
18) What are the browser
related issues for jQuery?
Browser compatibility of jQuery plugin is an
issue and needs lot of time to fix it.
19) Whether we need to
add jQuery file in both Master and Content page?
jQuery file should be added to the Master
page and can use access from the content page directly without having any
reference to it.
20) What are the basic
selectors in jQuery?
Following are the basic selectors in jQuery:
·
Element
ID
·
CSS
Name
·
Tag
Name
·
DOM
hierarchy
21) Can we call C# code
behind using jQuery?
Yes, we can call C# code from jQuery as it
supports .net application.
22) What is the use
jQuery.data method?
jQuery.data methods is used to associate the
data with the DOM nodes and the objects. This data method makes the jQuery code
clear and concise.
23) What is the use of
each function in jQuery?
Each function is used to iterate each and
every element of an object. It is used to loop DOM elements, arrays and the
object properties.
24) What is the
difference between size and length of jQuery?
Size and length both returns the number of
element in an object. But length is faster than the size because length is a
property and size is a method.
25) Can we add more than
one ‘document.ready’ function in a page?
Yes, we can add more than one document.ready
function in a page. But, body.onload can be added once in a page.
26) What is the use of
jQuery load method?
jQuery load method is a powerful AJAX method
which is used to load the data from a server and assign the data into the
element without loading the page.
27) Whether our own
specific characters are used in place of $ in jQuery?
Yes, we can use our own variable in place of
$ by using the method called no Conflict () method.
var sample = $.noConflict()
28) What are the four
parameters used for jQuery Ajax method?
The four parameters are
1.
URL -
Need to specify the URL to send the request.
2.
type -
Specifies type of request(Get or Post).
3.
data -
Specifies data to be sent to server.
4.
Cache -
Whether the browser should cache the requested page.
29) What is the use of
jQuery filter?
The jQuery filter is used to filter the
certain values from the object list based on the criteria. Example is to filter
certain products from the master list of products in a cart website.
30) Which program is
useful for testing jQuery?
QUnit is used to test jQuery and it is very
easy and efficient.
31) Which sign is used as
a shortcut for jQuery?
Dollar ($) sign is used as a shortcut for
jQuery.
32) Is jQuery is a client
or server scripting?
jQuery is a client scripting.
33) What is the script
build up by jQuery?
jQuery is a Javascript file and it is single
javascript file that contains common DOM, event effects and Ajax functions.
34) How can we debug
jQuery?
There are two ways to debug jQuery:
Debugger keyword
·
Add the
debugger to the line from where we have to start debugging and then run Visual
Studio in Debug mode with F5 function key.
·
Insert
a break point after attaching the process
35) What are all the ways
to include jQuery in a page?
Following are the ways to include jQuery in a
page:
·
Local
copy inside script tag.
·
Remote
copy of jQuery.com.
·
Remote
copy of Ajax API.
·
Local
copy of script manager control.
·
Embedded
script using client script object.
36) What is the use of
jQuery.ajax method ()?
jQuery.ajax method is used for asynchronous
HTTP requests.
37) Where can we download
JQuery?
jQuery javascript can be downloaded from
jQuery official website – www.jquery.com
38) Is jQuery is a
replacement of JavaScript?
No, jQuery is not a replacement of
JavaScript.
39) What is called
chaining?
Chaining is used to connect multiple events
and functions in a selector.
40) What are the
advantages of jQuery?
Following are the advantages of jQuery:
·
Just a
JavaScript enhancement.
·
Coding
is simple, clear, reusable.
·
Removal
of writing more complex conditions and loops.
41) Whether C# code
behind can be called from jQuery?
Yes, we can call C# code behind from jQuery.
42) What is the use of
jQuery.data() method?
jQuery data method is used to associate data
with DOM nodes and JavaScript objects. This method will make a code very
concise and neat.
43) What is the
difference between onload() and document.ready()?
In a page, we can have only one onload
function but we can have more than one document.ready function. Document.ready
function is called when DOM is loaded but onload function is called when DOM
and images are loaded on the page.
44)
Is there any difference between body onload() and document.ready() function?
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.
45) What is the use of
jQuery each function?
jQuery each function is used to loop through
each and every element of the target jQuery object. It is also useful for multi
element DOM, looping arrays and object properties.
46) How method can be
called inside code behind using jQuery?
$.ajax can be called and by declaring
WebMethod inside code behind using jQuery.
47) Where jQuery code is
getting executed?
jQuery code is getting executed on a client
browser.
48) What is the method
used to define the specific character in place of $ sign?
‘NoConflict’ method is used to reference a
jQuery and save it in a variable. That variable can be used instead of Sign.
49) Why jQuery is better
than JavaScript?
jQuery is a library used for developing Ajax
application and it helps to write the code clean and concise. It also handles
events, animation and Ajax support applications.
50) What are the types of
selectors in jQuery?
There are three types of selectors in jQuery:
1.
CSS
Selector
2.
XPath
Selector
3.
Custom
Selector
51)
What are selectors in jQuery and how many types of selectors are there?
To work with an element on the web page, first we
need to find them. To find the html element in JQuery we use selectors. There
are many types of selectors but basic selectors are:
·
Name: Selects all elements which
match with the given element Name.
·
#ID: Selects a single element which
matches with the given ID
·
.Class: Selects all elements which
match with the given Class.
·
Universal (*): Selects all elements
available in a DOM.
·
Multiple Elements E, F, G: Selects
the combined results of all the specified selectors E, F or G.
·
Attribute Selector: Select elements
based on its attribute value.
52) Which is the fastest
selector in jQuery?
ID and Element are the fastest selectors in
jQuery.
53) What is the slowest
selector in jQuery?
Class selectors are the slowest selectors in
jQuery.
54)
How do you select element by ID in jQuery?
To select element use ID selector. We need to
prefix the id with "#" (hash symbol). For example, to select element
with ID "txtName", then syntax would be,
$('#txtName')
55)
What does $("div") will select?
This will select
all the div elements on page.
56) How to select element having a particular class (".selected")?
$('.selected'). This selector is
known as class selector. We need to prefix the class name with "."(dot).
57)
What does $("div.parent") will select?
All the div
element with parent class.
58)
What are the fastest selectors in jQuery?
ID and element
selectors are the fatest selectors in jQuery.
59) What are the slow selectors in jQuery?
Class selectors are the slow compare to ID and
element.
60)
How jQuery selectors are executed?
Your last selectors are always executed first. For
example, in below jQuery code, jQuery will first find all the elements with
class ".myCssClass" and after that it will reject all the other
elements which are not in "p#elmID".
$("p#elmID
.myCssClass");
61)
Which is fast document.getElementByID('txtName') or $('#txtName').?
Native JavaScipt is always fast. jQuery method to
select txtName "$('#txtName')" will internally makes a call to document.getElementByID('txtName').
As jQuery is written on top of JavaScript
and it internally uses JavaScript only So
JavaScript is always fast.
No comments:
Post a Comment