May 13

jQuery Interview Questions and Answers

Q1. What is jQuery?
Ans. : Jquery is lightweight client side JavaScript library which help to traverse html DOM ,  call ajax , make animation and make changes in page content. Jquery used  “$” sign in short hand to write jquery code. It also use for change the UI and style. It is most popular JavaScript client side liberary.

Syntax for call onload function :


Function definition

Q2. Why do we use jQuery?
Ans. Following reason behind use of jquery

  1. Easily expandable
  2. Easy to use and learn.
  3. Cross-browser support (IE 6.0+, FF 1.5+, Safari 2.0+, Opera 9.0+)
  4. Easy to use for DOM manipulation and traversal.
  5. Large pool of built in methods.
  6. AJAX Capabilities.
  7. Methods for changing or applying CSS, creating animations.
  8. Event detection and handling.
  9. Tons of plug-ins for all kind of needs.

Q3. Does jQuery follow W3C recommendations?
Ans. No.

Q4. What is the basic need to start with jQuery?
Ans. To Start jquery we need to reference of jQuery Liberary. The latest version of jQuery can be downloaded from jQuery.com.

Q5. Which is the starting point of code execution in jQuery?
Ans. The starting point of jquery execution is “$(document).ready()” function which is executed when Dom is loaded.

Q6. Can we have multiple document.ready() function on the same page?
Ans. YES

Q7. What does dollar sign ($) means in jQuery?
Ans. Doller sing is alias for jQuery

for Example

$(document).ready(function() {

//Do Somthing


jQuery(document).ready(function() {

//Do Somthing


Q8. Can we use our own specific character in the place of $ sign in jQuery?
Ans. YES, It is Possible using jQuery.noConflict().

Q9. What is jQuery.noConflict?
Ans. As other client side libraries like MooTools, Prototype can be used with jQuery and they also use $() as their global function and to define variables. This situation creates conflict as $() is used by jQuery and other library as their global function. To overcome from such situations, jQuery has introduced jQuery.noConflict().

For Example.





we can also use our own specific character in the place of $() sign.

For Example






Q10. How JavaScript and jQuery are different?
Ans. Javascript is language while jQuery is library built in javascript. It make easy to use of javascript functionality.

Q11. Is jQuery replacement of Java Script?
Ans. No, jQuery is not replacement of javascript because jQuery is library which written on top of javascript.

Q12. Is jQuery a library for client scripting or server scripting?
Ans. Client side scripting

Q13. Is it possible to use other client side libraries like MooTools, Prototype along with jQuery?
Ans. Yes

Q14. What is a CDN?
Ans. A content delivery network or content distribution network (CDN) is a large distributed system of servers deployed in multiple data centers across the Internet. The goal of a CDN is to serve content to end-users with high availability and high performance.

Q15. Which are the popular jQuery CDN? and what is the advantage of using CDN?
Ans. Following are the popular jQuery CDN.

1. Google

2. jQuery

3. Microsot

Advantage of CDN

It reduce the load from your server

It save bandwidth

The most important benefit is it will be cached, if the user has visited any site which is using jQuery framework from any of these CDN

Q16. How to load jQuery from CDN?
Ans. Code to load jQuery from google CDN

<script type="text/javascript" src=”http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js”></script>

Code to load jQuery from microsoft CDN

<script type="text/javascript" src=”http://code.jquery.com/jquery-1.9.1.min.js”></script>

Code to load jQuery from jQuery CDN

<script type="text/javascript" src=”http://code.jquery.com/jquery-1.9.1.min.js”></script>

Q17. How to load jQuery locally when CDN fails?
Ans. Below given jQuery code checks whether jQuery is loaded from Google CDN or not, if not then it references the jQuery.js file from your folder.

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>

<script type=”text/javascript”>

if (typeof jQuery == ‘undefined’)

document.write(unescape(“<script src=’Scripts/jquery.1.9.1.min.js’ type=’text/javascript'</script>”));


Above code first load the jquery from google CDN if fail to load jquery from google CDN then it will load from local hard drive.

Q17. Is there any difference between body onload() and document.ready() function?
Ans. Body onload() is different from document.ready() function reason given below

1. We can use more than one document.ready() function on a page but onload() function use only once on page.

2. document.ready() call as soon as DOM is load but onload() load function is call when everything is loaded on page that include DOM, images and all associated resource

Q18. What is the difference between .js and .min.js?
Ans.  jQuery library comes in 2 different versions Production and Deployment. The deployment version is also known as minified version. So .min.js is basically the minified version of jQuery library file. Both the files are same as far as functionality is concerned. but .min.js is quite small in size so it loads quickly and saves bandwidth.

Q19. Why there are two different version of jQuery library?
Ans.  jQuery library comes in 2 different versions.



The production version is quite useful at development time as jQuery is open source and if you want to change something then you can make those changes in production version. But the deployment version is minified version or compressed version so it is impossible to make changes in it. Because it is compressed, so its size is very less than the production version which affects the page load time.

Q20. Whether jQuery HTML work for both HTML and XML documents?

Ans. No, jQuery HTML only works for HTML documents not for XML Documents.


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>