170 likes | 441 Views
Cleveland C#/VB.Net User Group February 24, 2009 Marv Schwartz mss@case.edu. An Introduction to jQuery. Raise your hand if …. … you write cascading style sheets (css) … you write ASP.net software? … you write javascript? … you write jQuery? … you enjoy writing javascript?.
E N D
Cleveland C#/VB.Net User Group February 24, 2009 Marv Schwartz mss@case.edu An Introduction to jQuery
Raise your hand if … • … you write cascading style sheets (css) • … you write ASP.net software? • … you write javascript? • … you write jQuery? • … you enjoy writing javascript?
www.accomplish.tonight • Why YOU might use jQuery • How to update VS-2008 for jQuery • Write some jQuery code • Ideas for debugging jQuery code • References Sam Nasr has kindly agreed to post these slides on http://www.clevelanddotnet.info/.
With AJAX … • Javascript has become essential to current web page development, but … • Javascript is not a good language design • Javascript has become bloated • DOM navigation • Browser differences • Writing Javascript code is tedious, time-consuming, and error-prone
Why YOU Might Want to Use jQuery • jQuery makes writing Javascript much easier • DOM navigation (css-like syntax) • Apply methods to sets of DOM elements • Builder model (chain method calls) • Extensible and there are tons of libraries • Handles most browser differences so you don’t have to • Server provides data • jQuery on client provides presentation
Scott Guthrie’s Blog Scott Guthrie is a Corporate Vice President in the Microsoft Developer Division. He runs the development teams that build the following products/technologies: • CLR and the core .NET Base Class Libraries • ASP.NET • Silverlight • WPF • IIS 7.0 • Visual Studio Tools for ASP.NET, WPF, Silverlight and Mobile • jQuery and Microsoft (Google ScottGujQuery)
jQuery and Microsoft Scott Guthrie announced “… that Microsoft will be shipping jQuery with Visual Studio going forward. We will distribute the jQuery JavaScript library as-is, and will not be forking or changing the source from the main jQuery branch. The files will continue to use and ship under the existing jQuery MIT license. We will also distribute intellisense-annotated versions that provide great Visual Studio intellisense and help-integration at design-time”
jQueryIntellisense in VS2008 • ScottGu, jQuery Intellisense in VS 2008 http://weblogs.asp.net/scottgu/archive/2008/11/21/jquery-intellisense-in-vs-2008.aspx • VS2008 sp1 • KB958502-JScript Editor support for“-vsdoc.js” IntelliSense documentation fileshttp://code.msdn.microsoft.com/KB958502/Release/ProjectReleases.aspx?ReleaseId=1736
FLOSS Podcast jQuery Episode February 7th, 2009 FLOSS Weekly 55: jQuery Hosts: Randal Schwartz and Leo Laporte jQuery, a lightweight JavaScript library emphasizing JavaScript and HTML interaction. Guest: John Resig for jQuery TWiT Wiki for this show John Resig is the creator, project lead and the head of the development team of the jQuery JavaScript library, released in January, 2006. For Resig's day job he works as a JavaScript Evangelist for the Mozilla Corporation, where he does JavaScript testing, performance analysis, speaking, and writing. He's also the author of a number of other projects, including: Sizzle: A cross-browser, standalone, JavaScript library for implementing CSS selector DOM selection in JavaScript, which is in the process of being integrated into jQuery, Prototype, Sizzle, YUI, and MochiKIt. Processing.js: A port of the Processing visualization language to JavaScript (running in an HTML 5 canvas element). Resig also speaks on the Open Web Podcast with Dion Almaer and Alex Russel, where they discuss web standards, JavaScript, and browsers. He's the author of the book "Pro JavaScript Techniques" and is working on his second book: "Secrets of the JavaScript Ninja" (due out in 2009)
jQuery Projects • HTML only • Text • Tables • ASP.net AJAX
AJAX example • ASP.net • No ScriptHandler • Uses WebMethods • Uses query string
Deployment • Compress jQuery-1.3.2.js • or use Google to host jQueryhttp://code.google.com/apis/ajax/documentation/ • Not needed: jQuery-1.3.2.vsdoc.js
jQuery Resources • Plugins: http://docs.jquery.com/Plugins • and Google returns many more • flot • SimpleModal
Getting a feel for jQuery • jQuery in Action • http://www.manning.com/bibeault/ • chapter2\lab selectors.html • chapter2\lab.wrapped.set.html
References • http://jquery.com/ • Scott Guthrie’s blog:http://weblogs.asp.net/scottgu/ • Rick Strahl’s blog:http://www.west-wind.com/weblog/ • Book: jQuery in Action
Final thoughts A problem with Google is that it finds outdated information as easily as current information. Integration with Visual Studio 2008 is improving quickly. Be wary of old hints. Some are unnecessary. Some break things. Go code some cool web pages using jQuery. Thank you. Marv Schwartz mss@case.edu