Download presentation
Presentation is loading. Please wait.
1
Jax Code Camp 2010 Good morning
2
iPhone Dev How to develop for the iOS 4
3
jQuery 1.4 and ASP.NET Jax Code Camp 2010
4
About Me David Fekke Software Engineer Lender Processing Services Fekke L.L.C. iPhone, iPad and Android Apps ASP.NET and ColdFusion
5
Douglas Crockford “Good architecture is necessary to give programs enough structure to be able to grow large without collapsing into a puddle of confusion.”
6
John Resig “The DOM is a mess!”
7
jQuery Javascript Framework 2006 Included with Visual Studio 20% of all websites 31% of top 10,000 websites
8
Licensing FREE MIT License Included with Visual Studio Tell the lawyers to relax
9
jQuery features Do a lot with very little code Chain multiple commands together AJAX Library UI Library
10
Sample jQuery $(“div.myClass”).fadeOut().addClass(“myNewClass”);
11
Microsoft Support Microsoft on JQuery Board Supported since Visual Studio 2008 sp1 Intellisense support Libraries come included in certain projects
12
Getting Started Download from jquery.com Can use a CDN such as Google Include jQuery library in your html
13
scripts/jquery.js
14
jQuery();
15
$();
16
jQuery plays with others $ is an Alias of jQuery jQuery.noConflict(); will turn off $ alias Must be run in document ready()
17
Page Load onload can be used, but not preferred $(document).ready() same as onload $() will work as a shortcut
18
Sizzle Selector Library Selector Library now its own project Core to how jQuery works CSS 1-3 selectors for matching elements
19
Querying in jQuery select any DOM element $(document); // Document object $(p); // all paragraph elements $(tr:nth-child(1)); // first row of each table $(p > a); // all anchors inside paragraph tags
20
Trigger Events $(a#home).bind(“click”,fn); $(a#home).click(fn); $(a#home).live(“click”,fn);
21
Utility functions $.trim(someString); $.makeArray(obj); $.unique(array)
22
Traversing next(expr) previous(expr) parents(expr) siblings(expr) children(expr)
23
Chaining $(‘p’).next().css(‘font’,’Times’).append(‘ ’ );
24
Use Each with Wrapped Sets $(a) returns array var single_item = $(a)[0]; Each(function(){ //do something })
25
AJAX jQuery.getJSON(); jQuery.ajax();
26
{"menu": { "id": "file", "value": "File", "popup": { "menuitem": [ {"value": "New", "onclick": "CreateNewDoc()"}, {"value": "Open", "onclick": "OpenDoc()"}, {"value": "Close", "onclick": "CloseDoc()"} ] } }}
27
jQuery and.NET Use REST over SOAP Try to use JSON over XML if possible WCF can output JSON var svc = new Sys.Data.DataService("j.svc") ASP.NET MVC can handle JSON actions
28
Plugins jQuery is extensible Write your own jQuery.fn.mypluginname = fn() Huge Ecosystem of Plugins
29
New to 1.4 $().live(“eventType”, fn); $().closest(“eventType”, fn); $().proxy(fn, context);
30
Demo
31
Resources jQuery.com http://jqueryui.com http://jquery14.com http://www.manning.com/bibeault/
32
? Questions ?
33
How to Contact me davidfekke @ gmail dot com twitter @davidfekke Blog at http://www.fekke.com/blog/
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.