jQuery interview questions and answers – Part3

21. Why there are two different version of jQuery library?
jQuery library comes in 2 different versions.
1. Development
2. Production/Deployment
The development 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 development 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.

22.What is JQuery UI?
JQuery UI is a library which is built on top of JQuery library. JQuery UI comes with cool widgets, effects and interaction mechanism.

23. Which version of jQuery file should be used?
In most of the recent releases so far, the core functionality of jQuery remains same however some more cool and better features are added. Ideally you should use the latest jQuery files available on the jQuery.com website. By doing this you ensure that your earlier functionality will still work and you can use new features available as part of the new release.

24. What if the latest jQuery version is available and I am still referring older version of jQuery file from CDNs?
Do not worry about it, it?s a general promise made by CDNs that they will remain hosting the older version of the files on the same location where they had initially released; so even if newer version of the files are released, the older version remains there on the CDNs and your web page still works.

25. Do we need to add the JQuery file both at the Master page and Content page as well on .Net Applications?
No, if the Jquery file has been added to the master page then we can access the content page directly without adding any reference to it.
This can be done using this simple example
<script type=”text/javascript” src=”jQuery-1.4.1-min.js”></script>

26. Where does code execution begin in jQuery?
Execution starts from $(document).ready() function which gets executed once the DOM is loaded.

27. Can you have multiple document.ready() functions on the same page?
Indeed. We can have as many document.ready() functions as we want.

28. How do you load jQuery?
1. You can load jQuery locally or
2. Load from a CDN like Google, Microsoft or jQuery
Loading locally:
< !DOCTYPE html>
<script type=”javascript” src=”/js/jquery.min.js”></script>

Loading from a CDN:
< !DOCTYPE html>
<script type=”javascript” src=”http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js”></script>


29. How do you load jQuery when a CDN fails to deliver?
Load locally when CDN fails:
<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(“%3Cscript src=’js/jquery.1.9.1.min.js’ type=’text/javascript’%3E%3C/script%3E”));

30. What are some popular CDNs for jQuery? Why should you use them?
We referred to one CDN (Content Delivery Network) in an earlier question – the Google Developer library. CDNs make file delivery far faster than if the same file was self-hosted on your server. Additionally, most visitors will have a cached copy of the file on their computer (since it is already referred to by other websites), which will further increase speed. Plus, as mentioned before, it ensures that you always have the latest version of jQuery.
Some of the popular jQuery CDNs are:
• Google developer libraries
• Microsoft Ajax CDN
• Max CDN (the official jQuery.com CDN)

Sign-up for our email newsletter and get free job alerts, current affairs and GK updates regularly.
Subscribe Here (or)

Leave a Reply

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

− 1 = four

Popup Dialog Box Powered By : XYZScripts.com
  • RSS
  • Facebook
  • Google+
  • Twitter