SlideShare une entreprise Scribd logo
1  sur  20
Introduce jQuery By Bank2u
jQuery Cross-browser javascript library Free & Opensource First released Jan 06 @Barcamp by John Resig Last stable version 1.4.2
Why jQuery ? Cross-browser compatibility Fast & Small  Plug-in Learning curve & Documentation Intellisense in VS2008-2010 Microsoft [Ajax Lib & MVC]
Why jQuery ?
Who’s using jQuery Microsoft Google Mozilla digg Wordpress & Drupal HP - IBM - Intel. Ruby on Rails
Getting Start Download jQuery at jquery.com <script type="text/javascript" src="/js/jQuery. js"></script> Microsoft CDN or Google CDN <script src="http://ajax.microsoft.com/ajax/jquery/jquery-1.4.2.js" type="text/javascript"></script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js"></script>
Hello world jQuery Document ready $(document).ready(function () {     alert("Hello world jQuery"); }); // Short cut $(function () {     alert("Hello world jQuery"); });
jQuery Philosophy Find someone from HTML (selector) Do something to it (method)
Find some element
Selector CSS Style $(“#myID”) 		// by id $(“.myClass”) 		// by class name $(“myTag”) 		// by tag (element name) $(“#id, .class, tag”)  // multiple
Selector [Hierarchy] $("form input")	// descendant $("#main > *")	//  child $("#prev ~ div")	//  sibling
Selector [Hierarchy] $("form input")	// descendant <form>     <div>         Form is surrounded by the green outline</div>     <label>         Child:</label> <input name="name" />     <fieldset>         <label>             Grandchild:</label> <input name="newsletter" />     </fieldset> </form>
Selector [Attribute] $("div[id]"). 				//has $("input[name='bank']“)		//not has $("input[name^='news']")	//equal $("input[name$='letter']") 	//begin with $("input[name$='letter']") 	//end with $("input[name*='man']") 	//contain $("input[id][name$='man']")
Selector [Form] $("div :text") $("form :radio") $("#dvMainForm :checkbox") $(":button") $("input:disabled") $("input:checked")
Do something with them
Attribute $("em").attr("title") $("label").html() $("p:first").text() $("input").val() Get ,[object Object]
$("label").html("zupzip")
$("p:first").text("zupzip")
$("input").val("zupzip")Set
Event Bind $(“input”).bind(“blur”, fn); Trigger $(“input”).trigger(“focus”); Event Helper $(“input”).click(function() { alert(‘click’); }); S(“input”).click(); Live $(“input”).live(“click”, fn);

Contenu connexe

Tendances

Understanding progressive enhancement - yuiconf2010
Understanding progressive enhancement - yuiconf2010Understanding progressive enhancement - yuiconf2010
Understanding progressive enhancement - yuiconf2010
Christian Heilmann
 

Tendances (20)

AngularJS vs React JS vs Node JS: Which is Best For Web Development ?
AngularJS vs React JS vs Node JS: Which is Best For Web Development ?AngularJS vs React JS vs Node JS: Which is Best For Web Development ?
AngularJS vs React JS vs Node JS: Which is Best For Web Development ?
 
10 things to make you a Great Mobile Web Developer
10 things to make you a Great Mobile Web Developer10 things to make you a Great Mobile Web Developer
10 things to make you a Great Mobile Web Developer
 
Doing Modern Web, aka JavaScript and HTML5 in the Enterprise
Doing Modern Web, aka JavaScript and HTML5 in the EnterpriseDoing Modern Web, aka JavaScript and HTML5 in the Enterprise
Doing Modern Web, aka JavaScript and HTML5 in the Enterprise
 
Top java script frameworks ppt
Top java script frameworks pptTop java script frameworks ppt
Top java script frameworks ppt
 
Anyone Can Code: JavaScript - 6/24/2014
Anyone Can Code: JavaScript - 6/24/2014Anyone Can Code: JavaScript - 6/24/2014
Anyone Can Code: JavaScript - 6/24/2014
 
HTML5@电子商务.com
HTML5@电子商务.comHTML5@电子商务.com
HTML5@电子商务.com
 
Understanding progressive enhancement - yuiconf2010
Understanding progressive enhancement - yuiconf2010Understanding progressive enhancement - yuiconf2010
Understanding progressive enhancement - yuiconf2010
 
Organisation of professional JavaScript Projects
Organisation of professional JavaScript ProjectsOrganisation of professional JavaScript Projects
Organisation of professional JavaScript Projects
 
Front End Development for Back End Developers - Devoxx UK 2017
 Front End Development for Back End Developers - Devoxx UK 2017 Front End Development for Back End Developers - Devoxx UK 2017
Front End Development for Back End Developers - Devoxx UK 2017
 
Javascript Frameworks Comparison - Angular, Knockout, Ember and Backbone
Javascript Frameworks Comparison - Angular, Knockout, Ember and BackboneJavascript Frameworks Comparison - Angular, Knockout, Ember and Backbone
Javascript Frameworks Comparison - Angular, Knockout, Ember and Backbone
 
JavaScript MV* Framework - Making the Right Choice
JavaScript MV* Framework - Making the Right ChoiceJavaScript MV* Framework - Making the Right Choice
JavaScript MV* Framework - Making the Right Choice
 
On Selecting JavaScript Frameworks (Women Who Code 10/15)
On Selecting JavaScript Frameworks (Women Who Code 10/15)On Selecting JavaScript Frameworks (Women Who Code 10/15)
On Selecting JavaScript Frameworks (Women Who Code 10/15)
 
jQuery Chicago 2014 - Next-generation JavaScript Testing
jQuery Chicago 2014 - Next-generation JavaScript TestingjQuery Chicago 2014 - Next-generation JavaScript Testing
jQuery Chicago 2014 - Next-generation JavaScript Testing
 
How fast are we going now?
How fast are we going now?How fast are we going now?
How fast are we going now?
 
Worry Free Web Development
Worry Free Web DevelopmentWorry Free Web Development
Worry Free Web Development
 
do u webview?
do u webview?do u webview?
do u webview?
 
High Performance Snippets
High Performance SnippetsHigh Performance Snippets
High Performance Snippets
 
Modern Web Application Development Workflow - EclipseCon US 2014
Modern Web Application Development Workflow - EclipseCon US 2014Modern Web Application Development Workflow - EclipseCon US 2014
Modern Web Application Development Workflow - EclipseCon US 2014
 
Make mobile web apps rock
Make mobile web apps rockMake mobile web apps rock
Make mobile web apps rock
 
Node PDX: Intro to Sails.js
Node PDX: Intro to Sails.jsNode PDX: Intro to Sails.js
Node PDX: Intro to Sails.js
 

En vedette (6)

Build your web app with asp.net mvc 2 from scratch
Build your web app with asp.net mvc 2 from scratchBuild your web app with asp.net mvc 2 from scratch
Build your web app with asp.net mvc 2 from scratch
 
Gf vtzz-05--j queryshowcase
Gf vtzz-05--j queryshowcaseGf vtzz-05--j queryshowcase
Gf vtzz-05--j queryshowcase
 
ZZ BC#7.5 asp.net mvc practice and guideline refresh!
ZZ BC#7.5 asp.net mvc practice  and guideline refresh! ZZ BC#7.5 asp.net mvc practice  and guideline refresh!
ZZ BC#7.5 asp.net mvc practice and guideline refresh!
 
ZZ BC#7 asp.net mvc practice and guideline by NineMvp
ZZ BC#7 asp.net mvc practice and guideline by NineMvpZZ BC#7 asp.net mvc practice and guideline by NineMvp
ZZ BC#7 asp.net mvc practice and guideline by NineMvp
 
DevRock #02 akka.net intro part
DevRock #02 akka.net intro partDevRock #02 akka.net intro part
DevRock #02 akka.net intro part
 
Build your website with angularjs and web apis
Build your website with angularjs and web apisBuild your website with angularjs and web apis
Build your website with angularjs and web apis
 

Similaire à J query

Intro to jQuery - LUGOR - Part 1
Intro to jQuery - LUGOR - Part 1Intro to jQuery - LUGOR - Part 1
Intro to jQuery - LUGOR - Part 1
Ralph Whitbeck
 
Strutsjspservlet
Strutsjspservlet Strutsjspservlet
Strutsjspservlet
Sagar Nakul
 
Microsoft UK TechDays - jQuery and ASP.NET
Microsoft UK TechDays - jQuery and ASP.NETMicrosoft UK TechDays - jQuery and ASP.NET
Microsoft UK TechDays - jQuery and ASP.NET
ukdpe
 

Similaire à J query (20)

jQuery and_drupal
jQuery and_drupaljQuery and_drupal
jQuery and_drupal
 
J Query Presentation
J Query PresentationJ Query Presentation
J Query Presentation
 
jQuery Ecosystem
jQuery EcosystemjQuery Ecosystem
jQuery Ecosystem
 
Intro to jQuery
Intro to jQueryIntro to jQuery
Intro to jQuery
 
Front End Development for Back End Java Developers - NYJavaSIG 2019
Front End Development for Back End Java Developers - NYJavaSIG 2019Front End Development for Back End Java Developers - NYJavaSIG 2019
Front End Development for Back End Java Developers - NYJavaSIG 2019
 
Intro to jQuery - LUGOR - Part 1
Intro to jQuery - LUGOR - Part 1Intro to jQuery - LUGOR - Part 1
Intro to jQuery - LUGOR - Part 1
 
Struts,Jsp,Servlet
Struts,Jsp,ServletStruts,Jsp,Servlet
Struts,Jsp,Servlet
 
Strutsjspservlet
Strutsjspservlet Strutsjspservlet
Strutsjspservlet
 
Strutsjspservlet
Strutsjspservlet Strutsjspservlet
Strutsjspservlet
 
Building Smart Workflows - Dan Diebolt
Building Smart Workflows - Dan DieboltBuilding Smart Workflows - Dan Diebolt
Building Smart Workflows - Dan Diebolt
 
Ajax to the Moon
Ajax to the MoonAjax to the Moon
Ajax to the Moon
 
Front End Development for Back End Developers - UberConf 2017
Front End Development for Back End Developers - UberConf 2017Front End Development for Back End Developers - UberConf 2017
Front End Development for Back End Developers - UberConf 2017
 
Jquery
Jquery Jquery
Jquery
 
Introduction to JQuery, ASP.NET MVC and Silverlight
Introduction to JQuery, ASP.NET MVC and SilverlightIntroduction to JQuery, ASP.NET MVC and Silverlight
Introduction to JQuery, ASP.NET MVC and Silverlight
 
Front End Development for Back End Developers - vJUG24 2017
Front End Development for Back End Developers - vJUG24 2017Front End Development for Back End Developers - vJUG24 2017
Front End Development for Back End Developers - vJUG24 2017
 
Front End Development for Back End Java Developers - Jfokus 2020
Front End Development for Back End Java Developers - Jfokus 2020Front End Development for Back End Java Developers - Jfokus 2020
Front End Development for Back End Java Developers - Jfokus 2020
 
Microsoft UK TechDays - jQuery and ASP.NET
Microsoft UK TechDays - jQuery and ASP.NETMicrosoft UK TechDays - jQuery and ASP.NET
Microsoft UK TechDays - jQuery and ASP.NET
 
Overview on jQuery mobile
Overview on jQuery mobileOverview on jQuery mobile
Overview on jQuery mobile
 
Accelerated Adoption: HTML5 and CSS3 for ASP.NET Developers
Accelerated Adoption: HTML5 and CSS3 for ASP.NET DevelopersAccelerated Adoption: HTML5 and CSS3 for ASP.NET Developers
Accelerated Adoption: HTML5 and CSS3 for ASP.NET Developers
 
Google I/O 2012 - Protecting your user experience while integrating 3rd party...
Google I/O 2012 - Protecting your user experience while integrating 3rd party...Google I/O 2012 - Protecting your user experience while integrating 3rd party...
Google I/O 2012 - Protecting your user experience while integrating 3rd party...
 

J query

  • 2. jQuery Cross-browser javascript library Free & Opensource First released Jan 06 @Barcamp by John Resig Last stable version 1.4.2
  • 3. Why jQuery ? Cross-browser compatibility Fast & Small Plug-in Learning curve & Documentation Intellisense in VS2008-2010 Microsoft [Ajax Lib & MVC]
  • 5. Who’s using jQuery Microsoft Google Mozilla digg Wordpress & Drupal HP - IBM - Intel. Ruby on Rails
  • 6. Getting Start Download jQuery at jquery.com <script type="text/javascript" src="/js/jQuery. js"></script> Microsoft CDN or Google CDN <script src="http://ajax.microsoft.com/ajax/jquery/jquery-1.4.2.js" type="text/javascript"></script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js"></script>
  • 7. Hello world jQuery Document ready $(document).ready(function () { alert("Hello world jQuery"); }); // Short cut $(function () { alert("Hello world jQuery"); });
  • 8. jQuery Philosophy Find someone from HTML (selector) Do something to it (method)
  • 10. Selector CSS Style $(“#myID”) // by id $(“.myClass”) // by class name $(“myTag”) // by tag (element name) $(“#id, .class, tag”) // multiple
  • 11. Selector [Hierarchy] $("form input") // descendant $("#main > *") // child $("#prev ~ div") // sibling
  • 12. Selector [Hierarchy] $("form input") // descendant <form> <div> Form is surrounded by the green outline</div> <label> Child:</label> <input name="name" /> <fieldset> <label> Grandchild:</label> <input name="newsletter" /> </fieldset> </form>
  • 13. Selector [Attribute] $("div[id]"). //has $("input[name='bank']“) //not has $("input[name^='news']") //equal $("input[name$='letter']") //begin with $("input[name$='letter']") //end with $("input[name*='man']") //contain $("input[id][name$='man']")
  • 14. Selector [Form] $("div :text") $("form :radio") $("#dvMainForm :checkbox") $(":button") $("input:disabled") $("input:checked")
  • 16.
  • 20. Event Bind $(“input”).bind(“blur”, fn); Trigger $(“input”).trigger(“focus”); Event Helper $(“input”).click(function() { alert(‘click’); }); S(“input”).click(); Live $(“input”).live(“click”, fn);
  • 21. Traversing find $("p").find("span").css('color','red'); children $("div").children(".selected").css("color); parent $("tr").parent().get(0).tagName; next $("button[disabled]").next().text("this button is disabled"); prev$("p").prev(".selected").css("background", "yellow"); sibling $(".hilite").siblings() .css("color", "red")
  • 22. Manipulation append $("p").append("<strong>Hello</strong>"); appendTo$("span").appendTo("#foo"); prepend &prependTo after $("p").after("<b>Hello</b>"); before $("p").before("<b>Hello</b>");
  • 23. Effect show / hide toggle slide fade Custom animation