This document discusses jQuery, a popular JavaScript library. It provides an overview of jQuery, including what it is, why it is useful, its core concepts and API. It also discusses jQuery plugins and how to create a basic jQuery plugin in 6 steps.
2. Introduction Ralph Whitbeck jQuery Team Member, on the Developer Relations team Co-authored O’Rielly’s “jQuery Cookbook” Senior Web Application Engineer BrandLogic Corporation ( http://brandlogic.com) Blog: http://ralphwhitbeck.com Twitter: @RedWolves
4. Overview Who, what, where and why of jQuery Review Core jQuery Concepts jQuery API Overview jQuery plugins jQuery UI
5. Who uses jQuery 39.25% of all sites that use JavaScript About 30% of the top 10,000 sites http://trends.builtwith.com/javascript/JQuery
6. Who uses jQuery 39.25% of all sites that use JavaScript About 30% of the top 10,000 sites http://trends.builtwith.com/javascript/JQuery
7. What is jQuery? jQuery is a JavaScript Library! Dealing with the DOM (e.g. selecting, creating, traversing, changing, etc.) JavaScript Events Animations Ajax interactions
9. if (browserType == "ie") document.poppedLayer = eval('document.getElementById("HiddenDIV")'); else document.poppedLayer = eval('document.layers["HiddenDIV"]'); document.poppedLayer.style.visibility = "visible"; It means no more of this…
16. Why use jQuery? Helps us to simplify and speed up web development Allows us to avoid common headaches associated with cross-browser development Provides a large pool of plugins Large and active community Tested on 50 browsers, 11 platforms and mobile It’s for both developers and designers
17. Why use jQuery? Helps us to simplify and speed up web development Allows us to avoid common headaches associated with cross-browser development Provides a large pool of plugins Large and active community Tested on 50 browsers, 11 platforms and mobile It’s for both developers and designers
18. Why use jQuery? Helps us to simplify and speed up web development Allows us to avoid common headaches associated with cross-browser development Provides a large pool of plugins Large and active community Tested on 50 browsers, 11 platforms and mobile It’s for both developers and designers
19. Where to get jQuery Download the source from Github Or use a CDN jQuery CDN (Edgecast via (mt) http://code.jquery.com/jquery-1.4.2.min.js Minified version http://code.jquery.com/jquery-1.4.2.js Source version Google Microsoft
20. Core jQuery Concepts Select Something, do something Create something, do something Chaining and Operating Demo’d http://ejohn.org/apps/learn-jquery/ and http://ralphwhitbeck.com/talks/stackoverflowdevdays/createdosomething.html
21. jQuery API Overview Core Selectors Attributes Traversing Manipulation CSS Events Effects Ajax Utilities You can review Core Methods at: http://api.jquery.com
22. jQuery Plugins There are over 2200 plugins Plugins extend jQuery’s functionality If you can’t find the functionality in a plugin, make your own! You can make a jQuery Plugin in six steps
23. Step 1. create a private scope for $ alias <!DOCTYPE html><html><body> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script> (function($){ })(jQuery); </script></body></html> A jQuery plugin in 6 steps
24. Step 2. attach plugin to fn alias <!DOCTYPE html><html><body> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script> (function($){ $.fn.loveNotHate = function(){ $(this).text($(this).text().replace(/hate/g,'love')); }; })(jQuery); </script></body></html> A jQuery plugin in 6 steps
25. Step 2. attach plugin to fn alias <!DOCTYPE html><html><body> <p>I hate jQuery!</p> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script> (function($){ $.fn.loveNotHate = function(){ $(this).text($(this).text().replace(/hate/g,'love')); }; })(jQuery); jQuery('p').loveNotHate(); </script></body></html> A jQuery plugin in 6 steps
#14:Wrapped Set , is an array like structure that contains each of the selected DOM elements. You can iterate over the wrapped set like an array or access individual elements via the indexer. More importantly though you can also apply jQuery functions against all the selected elements.
#18:Any good JavaScript framework will do these top two points
#19:It’s these last four that really set jQuery apart
#20:It’s these last four that really set jQuery apart
#22:Show AIR APP (Screen 4) The API is broken up to help you find what you need to do one of the core jquery functions select, create, do something then do something else. The API is categorized by functionality