SlideShare a Scribd company logo
1 of 59
Unobtrusive Javascript with jQuery PresentationbyAngel Ruiz Calvo
Summary Javascript frameworks jQuery introduction Unobtrusive Javascript Lessons learned Working examples Thanks & Acknowledgements.
Why areJavascript frameworks needed?
Why areJavascript frameworks needed? Because this is how Javascript is seen by the browser:
Javascript frameworks Their main aim is to present a solid and usable API on top of Javascript  while at the same time it hides painful browser particularities and incompatibilities. Essential to make “cross-browser” web applications. Makes programming Javascript easier and simpler. There are a few available.
Javascript frameworks Their main aim is to present a solid and usable API on top of Javascript  while at the same time it hides painful browser particularities and incompatibilities. Essential to make “cross-browser” web applications. Makes programming Javascript easier and simpler. There are a few available.
jQuerysuccess is about ...
jQuerysuccess is about ... Plugins
jQuerysuccess is about ... Plugins Big community
jQuerysuccess is about ... Plugins Big community Industry support ...
jQuerysuccess is about ... Plugins Big community Industry support ... Lightweight
jQuerysuccess is about ... Plugins Big community Industry support ... Lightweight Speed
jQuerysuccess is about ... Plugins Big community Industry support ... Lightweight Speed Well documented
jQuerysuccess is about ... Plugins Big community Industry support ... Lightweight Speed Well documented Support
jQuerysuccess is about ... Plugins Big community Industry support ... Lightweight Speed Well documented Support Open/Free license
jQuery core philosophy Simplify iteration between HTML and Javascript Find HTML
jQuery core philosophy Simplify iteration between HTML and Javascript Find HTML Do something to it
jQuery core philosophy Simplify iteration between HTML and Javascript Find HTML Do something to it ,[object Object],<HTML> <BODY> 	<DIV>This is</DIV> 	<DIV>and example</DIV> </BODY>	 </HTML>
jQuery core philosophy Simplify iteration between HTML and Javascript Find HTML Do something to it ,[object Object],Find all divs $(“DIV”); <HTML> <BODY> <DIV>This is</DIV> <DIV>and example</DIV> </BODY>	 </HTML>
jQuery core philosophy Simplify iteration between HTML and Javascript Find HTML Do something to it ,[object Object],Find all divs Add class “foo” to all of them $(“DIV”).addClass(“foo”); <HTML> <BODY> <DIV class=“foo”>This is</DIV> 	<DIV class=“foo”>and example</DIV> </BODY>	 </HTML>
jQuery factory method $() Its argument is always a CSS selector (CSS3 support for 1.4+ versions). Examples: $(“#myID”);// get element with id=“myID” $(“.myClass”);// get elements with class name=“myClass”
jQuery factory method $() Its argument is always a CSS selector (CSS3 support for 1.4+ versions). Examples: $(“#myID”);// get element with id=“myID” $(“.myClass”);// get elements with class name=“myClass” $(“li:first”);// get first list item $(“tr:odd”);// get odd table rows
jQuery factory method $() Its argument is always a CSS selector (CSS3 support for 1.4+ versions). Examples: $(“#myID”);// get element with id=“myID” $(“.myClass”);// get elements with class name=“myClass” $(“li:first”);// get first list item $(“tr:odd”);// get odd table rows $(“a[target=_blank]”);// get all links whose target is “_blank” $(“form[id^=step]”);// get all forms whose id begins with 				// “step”
jQuery factory method $() Its argument is always a CSS selector (CSS3 support for 1.4+ versions). Examples: $(“#myID”);// get element with id=“myID” $(“.myClass”);// get elements with class name=“myClass” $(“li:first”);// get first list item $(“tr:odd”);// get odd table rows $(“a[target=_blank]”);// get all links whose target is “_blank” $(“form[id^=step]”);// get all forms whose id begins with 				// “step” Or you can combine them: $(“#myID, .myClass, table”);
jQuery factory method $() Its argument is always a CSS selector (CSS3 support for 1.4+ versions). Examples: $(“#myID”);// get element with id=“myID” $(“.myClass”);// get elements with class name=“myClass” $(“li:first”);// get first list item $(“tr:odd”);// get odd table rows $(“a[target=_blank]”);// get all links whose target is “_blank” $(“form[id^=step]”);// get all forms whose id begins with 				// “step” Or you can combine them: $(“#myID, .myClass, table”); More examples: http://codylindley.com/jqueryselectors/
jQuery API groups Moving elements before(), after(), appendTo(), append(), ...
jQuery API groups Moving elements before(), after(), appendTo(), append(), ... Attributes css(), attr(), html(), val(), addClass(), ...
jQuery API groups Moving elements before(), after(), appendTo(), append(), ... Attributes css(), attr(), html(), val(), addClass(), ... Events bind(), trigger(), unbind(), live(), click(), ...
jQuery API groups Moving elements before(), after(), appendTo(), append(), ... Attributes css(), attr(), html(), val(), addClass(), ... Events bind(), trigger(), unbind(), live(), click(), ... Effects show(), fadeOut(), toogle(), animate(), ...
jQuery API groups Moving elements before(), after(), appendTo(), append(), ... Attributes css(), attr(), html(), val(), addClass(), ... Events bind(), trigger(), unbind(), live(), click(), ... Effects show(), fadeOut(), toogle(), animate(), ... Traversing find(), is(), prevAll(), next(), hasClass(), ...
jQuery API groups Moving elements before(), after(), appendTo(), append(), ... Attributes css(), attr(), html(), val(), addClass(), ... Events bind(), trigger(), unbind(), live(), click(), ... Effects show(), fadeOut(), toogle(), animate(), ... Traversing find(), is(), prevAll(), next(), hasClass(), ... Ajax get(), getJSON(), post(), ajax(), load(), ...
jQuery API groups Moving elements before(), after(), appendTo(), append(), ... Attributes css(), attr(), html(), val(), addClass(), ... Events bind(), trigger(), unbind(), live(), click(), ... Effects show(), fadeOut(), toogle(), animate(), ... Traversing find(), is(), prevAll(), next(), hasClass(), ... Ajax get(), getJSON(), post(), ajax(), load(), ... More...
jQuery Plug-ins Here you can find everything you need: http://plugins.jquery.com/
jQuery Plug-ins Here you can find everything you need: http://plugins.jquery.com/ Well known plug-in libraries: http://flowplayer.org/tools/index.html http://jqueryui.com/
jQuery references The main documentation site is the best reference: http://docs.jquery.com
jQuery references The main documentation site is the best reference: http://docs.jquery.com To get up to speed we have purchased this book:
Unobtrusive Javascript It is a design paradigm for the web presentation layer (DHTML = HTML + CSS + Javascript) whose basic principles are:
Unobtrusive Javascript It is a design paradigm for the web presentation layer (DHTML = HTML + CSS + Javascript) whose basic principles are: Separate behaviour from structure (mark-up).
Unobtrusive Javascript It is a design paradigm for the web presentation layer (DHTML = HTML + CSS + Javascript) whose basic principles are: Separate behaviour from structure (mark-up). Follow best practises to avoid each browser particular issues.
Unobtrusive Javascript It is a design paradigm for the web presentation layer (DHTML = HTML + CSS + Javascript) whose basic principles are: Separate behaviour from structure (mark-up). Follow best practises to avoid each browser particular issues. “Progressive Enhancement” instead of “Graceful degradation”.
Separate behaviour from structure (mark-up). Before: <HTML> <BODY> 	<INPUT type=“button” onclick=“alert(‘Hello World’);”> </BODY>	 </HTML>
Separate behaviour from structure (mark-up). Before: After: <HTML> <BODY> 	<INPUT type=“button” onclick=“alert(‘Hello World’);”> </BODY>	 </HTML> <HTML> <BODY> 	<INPUT type=“button”> </BODY> <script type=“text/javascript”> 	$(“INPUT”).click(function(){alert(‘Hello World’);}); </script> </HTML>
Separate behaviour from structure (mark-up). Before: After: <HTML> <BODY> 	<INPUT type=“button” onclick=“alert(‘Hello World’);”> </BODY>	 </HTML> Don’t worry!! Experience will show you that  IT GETS BETTER THAN THAT!!! <HTML> <BODY> 	<INPUT type=“button”> </BODY> <script type=“text/javascript”> 	$(“INPUT”).click(function(){alert(‘Hello World’);}); </script> </HTML>
Follow best practises to avoid each browser particularaties. Basically use jQuery for your javascript.
Follow best practises to avoid each browser particularaties. Basically use jQuery for your javascript. But do not forget about CSS frameworks!!!
Follow best practises to avoid each browser particularaties. Basically use jQuery for your javascript. But do not forget about CSS frameworks!!! Why?
Follow best practises to avoid each browser particularaties. Basically use jQuery for your javascript. But do not forget about CSS frameworks!!! Why?
Follow best practises to avoid each browser particularaties. Basically use jQuery for your javascript. But do not forget about CSS frameworks!!! Why? Good examples of CSS frameworks: YAML:http://www.yaml.de/en/ Blueprint: http://www.blueprintcss.org/
“Graceful Degradation” e.g. Date Picker Renders both input field and button If javascript is disabled the button will not work
“Progressive Enhancement” e.g. Date Picker Renders both input field and hides button If javascript is enabled the button will be shown
Lessons learned Css at the top.
Lessons learned Css at the top. Javascript at the bottom (not always, e.g. jQuery import).
Lessons learned Css at the top. Javascript at the bottom (not always, e.g. jQuery import). Or remember: $(function (){   //code will execute after page load }),
Lessons learned Css at the top. Javascript at the bottom (not always, e.g. jQuery import). Or remember: which is equivalent to: $(function (){   //code will execute after page load }), $(document).ready(function (){});
Lessons learned Css at the top. Javascript at the bottom (not always, e.g. jQuery import). Or remember: which is equivalent to: ,                  , your “best friend”. $(function (){   //code will execute after page load }), $(document).ready(function (){});
Lessons learned Css at the top. Javascript at the bottom (not always, e.g. jQuery import). Or remember: which is equivalent to: ,                  , your “best friend”. Group, minify and gzip these static resources: $(function (){   //code will execute after page load }), $(document).ready(function (){});
Lessons learned Css at the top. Javascript at the bottom (not always, e.g. jQuery import). Or remember: which is equivalent to: ,                  , your “best friend”. Group, minify and gzip these static resources: Asses your page using Yslow You do not need to score 100. Try to follow the suggested best practices as much as possible. $(function (){   //code will execute after page load }), $(document).ready(function (){});
Any questions before showing working examples?
Thanks for listening The author ,[object Object],Acknowledgments ,[object Object]

More Related Content

What's hot

jQuery Fundamentals
jQuery FundamentalsjQuery Fundamentals
jQuery FundamentalsGil Fink
 
jQuery Presentation
jQuery PresentationjQuery Presentation
jQuery PresentationRod Johnson
 
jQuery: Nuts, Bolts and Bling
jQuery: Nuts, Bolts and BlingjQuery: Nuts, Bolts and Bling
jQuery: Nuts, Bolts and BlingDoug Neiner
 
Getting the Most Out of jQuery Widgets
Getting the Most Out of jQuery WidgetsGetting the Most Out of jQuery Widgets
Getting the Most Out of jQuery Widgetsvelveeta_512
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQueryZeeshan Khan
 
Learning jQuery in 30 minutes
Learning jQuery in 30 minutesLearning jQuery in 30 minutes
Learning jQuery in 30 minutesSimon Willison
 
Nothing Hard Baked: Designing the Inclusive Web
Nothing Hard Baked: Designing the Inclusive WebNothing Hard Baked: Designing the Inclusive Web
Nothing Hard Baked: Designing the Inclusive Webcolinbdclark
 
User Interface Development with jQuery
User Interface Development with jQueryUser Interface Development with jQuery
User Interface Development with jQuerycolinbdclark
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQueryGunjan Kumar
 
Organizing Code with JavascriptMVC
Organizing Code with JavascriptMVCOrganizing Code with JavascriptMVC
Organizing Code with JavascriptMVCThomas Reynolds
 
jQuery('#knowledge').appendTo('#you');
jQuery('#knowledge').appendTo('#you');jQuery('#knowledge').appendTo('#you');
jQuery('#knowledge').appendTo('#you');mikehostetler
 
Learning jQuery made exciting in an interactive session by one of our team me...
Learning jQuery made exciting in an interactive session by one of our team me...Learning jQuery made exciting in an interactive session by one of our team me...
Learning jQuery made exciting in an interactive session by one of our team me...Thinqloud
 

What's hot (20)

jQuery
jQueryjQuery
jQuery
 
jQuery Fundamentals
jQuery FundamentalsjQuery Fundamentals
jQuery Fundamentals
 
jQuery Presentation
jQuery PresentationjQuery Presentation
jQuery Presentation
 
jQuery: Nuts, Bolts and Bling
jQuery: Nuts, Bolts and BlingjQuery: Nuts, Bolts and Bling
jQuery: Nuts, Bolts and Bling
 
JQuery introduction
JQuery introductionJQuery introduction
JQuery introduction
 
jQuery
jQueryjQuery
jQuery
 
jQuery
jQueryjQuery
jQuery
 
The jQuery Library
The  jQuery LibraryThe  jQuery Library
The jQuery Library
 
jQuery Introduction
jQuery IntroductionjQuery Introduction
jQuery Introduction
 
Getting the Most Out of jQuery Widgets
Getting the Most Out of jQuery WidgetsGetting the Most Out of jQuery Widgets
Getting the Most Out of jQuery Widgets
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
 
D3.js and SVG
D3.js and SVGD3.js and SVG
D3.js and SVG
 
Learning jQuery in 30 minutes
Learning jQuery in 30 minutesLearning jQuery in 30 minutes
Learning jQuery in 30 minutes
 
FuncUnit
FuncUnitFuncUnit
FuncUnit
 
Nothing Hard Baked: Designing the Inclusive Web
Nothing Hard Baked: Designing the Inclusive WebNothing Hard Baked: Designing the Inclusive Web
Nothing Hard Baked: Designing the Inclusive Web
 
User Interface Development with jQuery
User Interface Development with jQueryUser Interface Development with jQuery
User Interface Development with jQuery
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
 
Organizing Code with JavascriptMVC
Organizing Code with JavascriptMVCOrganizing Code with JavascriptMVC
Organizing Code with JavascriptMVC
 
jQuery('#knowledge').appendTo('#you');
jQuery('#knowledge').appendTo('#you');jQuery('#knowledge').appendTo('#you');
jQuery('#knowledge').appendTo('#you');
 
Learning jQuery made exciting in an interactive session by one of our team me...
Learning jQuery made exciting in an interactive session by one of our team me...Learning jQuery made exciting in an interactive session by one of our team me...
Learning jQuery made exciting in an interactive session by one of our team me...
 

Similar to Unobtrusive javascript with jQuery

Jquery Complete Presentation along with Javascript Basics
Jquery Complete Presentation along with Javascript BasicsJquery Complete Presentation along with Javascript Basics
Jquery Complete Presentation along with Javascript BasicsEPAM Systems
 
jQuery Rescue Adventure
jQuery Rescue AdventurejQuery Rescue Adventure
jQuery Rescue AdventureAllegient
 
Jquery presentation
Jquery presentationJquery presentation
Jquery presentationguest5d87aa6
 
Kick start with j query
Kick start with j queryKick start with j query
Kick start with j queryMd. Ziaul Haq
 
Jarv.us Showcase — SenchaCon 2011
Jarv.us Showcase — SenchaCon 2011Jarv.us Showcase — SenchaCon 2011
Jarv.us Showcase — SenchaCon 2011Chris Alfano
 
Introduction to jQuery - Barcamp London 9
Introduction to jQuery - Barcamp London 9Introduction to jQuery - Barcamp London 9
Introduction to jQuery - Barcamp London 9Jack Franklin
 
How to increase Performance of Web Application using JQuery
How to increase Performance of Web Application using JQueryHow to increase Performance of Web Application using JQuery
How to increase Performance of Web Application using JQuerykolkatageeks
 
jQuery - 10 Time-Savers You (Maybe) Don't Know
jQuery - 10 Time-Savers You (Maybe) Don't KnowjQuery - 10 Time-Savers You (Maybe) Don't Know
jQuery - 10 Time-Savers You (Maybe) Don't Knowgirish82
 
Intro to jQuery
Intro to jQueryIntro to jQuery
Intro to jQueryAlan Hecht
 
jQuery - Introdução
jQuery - IntroduçãojQuery - Introdução
jQuery - IntroduçãoGustavo Dutra
 
JQuery do dia-a-dia Gustavo Dutra
JQuery do dia-a-dia Gustavo DutraJQuery do dia-a-dia Gustavo Dutra
JQuery do dia-a-dia Gustavo DutraTchelinux
 
jQuery Foot-Gun Features
jQuery Foot-Gun FeaturesjQuery Foot-Gun Features
jQuery Foot-Gun Featuresdmethvin
 
The Dom Scripting Toolkit J Query
The Dom Scripting Toolkit J QueryThe Dom Scripting Toolkit J Query
The Dom Scripting Toolkit J QueryQConLondon2008
 
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)Doris Chen
 
Jqueryforbeginnersjqueryconference2009 090914063709 Phpapp02
Jqueryforbeginnersjqueryconference2009 090914063709 Phpapp02Jqueryforbeginnersjqueryconference2009 090914063709 Phpapp02
Jqueryforbeginnersjqueryconference2009 090914063709 Phpapp02careersblog
 

Similar to Unobtrusive javascript with jQuery (20)

Jquery Complete Presentation along with Javascript Basics
Jquery Complete Presentation along with Javascript BasicsJquery Complete Presentation along with Javascript Basics
Jquery Complete Presentation along with Javascript Basics
 
jQuery Rescue Adventure
jQuery Rescue AdventurejQuery Rescue Adventure
jQuery Rescue Adventure
 
J query training
J query trainingJ query training
J query training
 
jQuery UI and Plugins
jQuery UI and PluginsjQuery UI and Plugins
jQuery UI and Plugins
 
Jquery presentation
Jquery presentationJquery presentation
Jquery presentation
 
Kick start with j query
Kick start with j queryKick start with j query
Kick start with j query
 
jQuery Essentials
jQuery EssentialsjQuery Essentials
jQuery Essentials
 
jQuery
jQueryjQuery
jQuery
 
Jarv.us Showcase — SenchaCon 2011
Jarv.us Showcase — SenchaCon 2011Jarv.us Showcase — SenchaCon 2011
Jarv.us Showcase — SenchaCon 2011
 
jQuery for web development
jQuery for web developmentjQuery for web development
jQuery for web development
 
Introduction to jQuery - Barcamp London 9
Introduction to jQuery - Barcamp London 9Introduction to jQuery - Barcamp London 9
Introduction to jQuery - Barcamp London 9
 
How to increase Performance of Web Application using JQuery
How to increase Performance of Web Application using JQueryHow to increase Performance of Web Application using JQuery
How to increase Performance of Web Application using JQuery
 
jQuery - 10 Time-Savers You (Maybe) Don't Know
jQuery - 10 Time-Savers You (Maybe) Don't KnowjQuery - 10 Time-Savers You (Maybe) Don't Know
jQuery - 10 Time-Savers You (Maybe) Don't Know
 
Intro to jQuery
Intro to jQueryIntro to jQuery
Intro to jQuery
 
jQuery - Introdução
jQuery - IntroduçãojQuery - Introdução
jQuery - Introdução
 
JQuery do dia-a-dia Gustavo Dutra
JQuery do dia-a-dia Gustavo DutraJQuery do dia-a-dia Gustavo Dutra
JQuery do dia-a-dia Gustavo Dutra
 
jQuery Foot-Gun Features
jQuery Foot-Gun FeaturesjQuery Foot-Gun Features
jQuery Foot-Gun Features
 
The Dom Scripting Toolkit J Query
The Dom Scripting Toolkit J QueryThe Dom Scripting Toolkit J Query
The Dom Scripting Toolkit J Query
 
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
 
Jqueryforbeginnersjqueryconference2009 090914063709 Phpapp02
Jqueryforbeginnersjqueryconference2009 090914063709 Phpapp02Jqueryforbeginnersjqueryconference2009 090914063709 Phpapp02
Jqueryforbeginnersjqueryconference2009 090914063709 Phpapp02
 

Recently uploaded

"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 

Recently uploaded (20)

"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 

Unobtrusive javascript with jQuery

  • 1. Unobtrusive Javascript with jQuery PresentationbyAngel Ruiz Calvo
  • 2. Summary Javascript frameworks jQuery introduction Unobtrusive Javascript Lessons learned Working examples Thanks & Acknowledgements.
  • 4. Why areJavascript frameworks needed? Because this is how Javascript is seen by the browser:
  • 5. Javascript frameworks Their main aim is to present a solid and usable API on top of Javascript while at the same time it hides painful browser particularities and incompatibilities. Essential to make “cross-browser” web applications. Makes programming Javascript easier and simpler. There are a few available.
  • 6. Javascript frameworks Their main aim is to present a solid and usable API on top of Javascript while at the same time it hides painful browser particularities and incompatibilities. Essential to make “cross-browser” web applications. Makes programming Javascript easier and simpler. There are a few available.
  • 9. jQuerysuccess is about ... Plugins Big community
  • 10. jQuerysuccess is about ... Plugins Big community Industry support ...
  • 11. jQuerysuccess is about ... Plugins Big community Industry support ... Lightweight
  • 12. jQuerysuccess is about ... Plugins Big community Industry support ... Lightweight Speed
  • 13. jQuerysuccess is about ... Plugins Big community Industry support ... Lightweight Speed Well documented
  • 14. jQuerysuccess is about ... Plugins Big community Industry support ... Lightweight Speed Well documented Support
  • 15. jQuerysuccess is about ... Plugins Big community Industry support ... Lightweight Speed Well documented Support Open/Free license
  • 16. jQuery core philosophy Simplify iteration between HTML and Javascript Find HTML
  • 17. jQuery core philosophy Simplify iteration between HTML and Javascript Find HTML Do something to it
  • 18.
  • 19.
  • 20.
  • 21. jQuery factory method $() Its argument is always a CSS selector (CSS3 support for 1.4+ versions). Examples: $(“#myID”);// get element with id=“myID” $(“.myClass”);// get elements with class name=“myClass”
  • 22. jQuery factory method $() Its argument is always a CSS selector (CSS3 support for 1.4+ versions). Examples: $(“#myID”);// get element with id=“myID” $(“.myClass”);// get elements with class name=“myClass” $(“li:first”);// get first list item $(“tr:odd”);// get odd table rows
  • 23. jQuery factory method $() Its argument is always a CSS selector (CSS3 support for 1.4+ versions). Examples: $(“#myID”);// get element with id=“myID” $(“.myClass”);// get elements with class name=“myClass” $(“li:first”);// get first list item $(“tr:odd”);// get odd table rows $(“a[target=_blank]”);// get all links whose target is “_blank” $(“form[id^=step]”);// get all forms whose id begins with // “step”
  • 24. jQuery factory method $() Its argument is always a CSS selector (CSS3 support for 1.4+ versions). Examples: $(“#myID”);// get element with id=“myID” $(“.myClass”);// get elements with class name=“myClass” $(“li:first”);// get first list item $(“tr:odd”);// get odd table rows $(“a[target=_blank]”);// get all links whose target is “_blank” $(“form[id^=step]”);// get all forms whose id begins with // “step” Or you can combine them: $(“#myID, .myClass, table”);
  • 25. jQuery factory method $() Its argument is always a CSS selector (CSS3 support for 1.4+ versions). Examples: $(“#myID”);// get element with id=“myID” $(“.myClass”);// get elements with class name=“myClass” $(“li:first”);// get first list item $(“tr:odd”);// get odd table rows $(“a[target=_blank]”);// get all links whose target is “_blank” $(“form[id^=step]”);// get all forms whose id begins with // “step” Or you can combine them: $(“#myID, .myClass, table”); More examples: http://codylindley.com/jqueryselectors/
  • 26. jQuery API groups Moving elements before(), after(), appendTo(), append(), ...
  • 27. jQuery API groups Moving elements before(), after(), appendTo(), append(), ... Attributes css(), attr(), html(), val(), addClass(), ...
  • 28. jQuery API groups Moving elements before(), after(), appendTo(), append(), ... Attributes css(), attr(), html(), val(), addClass(), ... Events bind(), trigger(), unbind(), live(), click(), ...
  • 29. jQuery API groups Moving elements before(), after(), appendTo(), append(), ... Attributes css(), attr(), html(), val(), addClass(), ... Events bind(), trigger(), unbind(), live(), click(), ... Effects show(), fadeOut(), toogle(), animate(), ...
  • 30. jQuery API groups Moving elements before(), after(), appendTo(), append(), ... Attributes css(), attr(), html(), val(), addClass(), ... Events bind(), trigger(), unbind(), live(), click(), ... Effects show(), fadeOut(), toogle(), animate(), ... Traversing find(), is(), prevAll(), next(), hasClass(), ...
  • 31. jQuery API groups Moving elements before(), after(), appendTo(), append(), ... Attributes css(), attr(), html(), val(), addClass(), ... Events bind(), trigger(), unbind(), live(), click(), ... Effects show(), fadeOut(), toogle(), animate(), ... Traversing find(), is(), prevAll(), next(), hasClass(), ... Ajax get(), getJSON(), post(), ajax(), load(), ...
  • 32. jQuery API groups Moving elements before(), after(), appendTo(), append(), ... Attributes css(), attr(), html(), val(), addClass(), ... Events bind(), trigger(), unbind(), live(), click(), ... Effects show(), fadeOut(), toogle(), animate(), ... Traversing find(), is(), prevAll(), next(), hasClass(), ... Ajax get(), getJSON(), post(), ajax(), load(), ... More...
  • 33. jQuery Plug-ins Here you can find everything you need: http://plugins.jquery.com/
  • 34. jQuery Plug-ins Here you can find everything you need: http://plugins.jquery.com/ Well known plug-in libraries: http://flowplayer.org/tools/index.html http://jqueryui.com/
  • 35. jQuery references The main documentation site is the best reference: http://docs.jquery.com
  • 36. jQuery references The main documentation site is the best reference: http://docs.jquery.com To get up to speed we have purchased this book:
  • 37. Unobtrusive Javascript It is a design paradigm for the web presentation layer (DHTML = HTML + CSS + Javascript) whose basic principles are:
  • 38. Unobtrusive Javascript It is a design paradigm for the web presentation layer (DHTML = HTML + CSS + Javascript) whose basic principles are: Separate behaviour from structure (mark-up).
  • 39. Unobtrusive Javascript It is a design paradigm for the web presentation layer (DHTML = HTML + CSS + Javascript) whose basic principles are: Separate behaviour from structure (mark-up). Follow best practises to avoid each browser particular issues.
  • 40. Unobtrusive Javascript It is a design paradigm for the web presentation layer (DHTML = HTML + CSS + Javascript) whose basic principles are: Separate behaviour from structure (mark-up). Follow best practises to avoid each browser particular issues. “Progressive Enhancement” instead of “Graceful degradation”.
  • 41. Separate behaviour from structure (mark-up). Before: <HTML> <BODY> <INPUT type=“button” onclick=“alert(‘Hello World’);”> </BODY> </HTML>
  • 42. Separate behaviour from structure (mark-up). Before: After: <HTML> <BODY> <INPUT type=“button” onclick=“alert(‘Hello World’);”> </BODY> </HTML> <HTML> <BODY> <INPUT type=“button”> </BODY> <script type=“text/javascript”> $(“INPUT”).click(function(){alert(‘Hello World’);}); </script> </HTML>
  • 43. Separate behaviour from structure (mark-up). Before: After: <HTML> <BODY> <INPUT type=“button” onclick=“alert(‘Hello World’);”> </BODY> </HTML> Don’t worry!! Experience will show you that IT GETS BETTER THAN THAT!!! <HTML> <BODY> <INPUT type=“button”> </BODY> <script type=“text/javascript”> $(“INPUT”).click(function(){alert(‘Hello World’);}); </script> </HTML>
  • 44. Follow best practises to avoid each browser particularaties. Basically use jQuery for your javascript.
  • 45. Follow best practises to avoid each browser particularaties. Basically use jQuery for your javascript. But do not forget about CSS frameworks!!!
  • 46. Follow best practises to avoid each browser particularaties. Basically use jQuery for your javascript. But do not forget about CSS frameworks!!! Why?
  • 47. Follow best practises to avoid each browser particularaties. Basically use jQuery for your javascript. But do not forget about CSS frameworks!!! Why?
  • 48. Follow best practises to avoid each browser particularaties. Basically use jQuery for your javascript. But do not forget about CSS frameworks!!! Why? Good examples of CSS frameworks: YAML:http://www.yaml.de/en/ Blueprint: http://www.blueprintcss.org/
  • 49. “Graceful Degradation” e.g. Date Picker Renders both input field and button If javascript is disabled the button will not work
  • 50. “Progressive Enhancement” e.g. Date Picker Renders both input field and hides button If javascript is enabled the button will be shown
  • 51. Lessons learned Css at the top.
  • 52. Lessons learned Css at the top. Javascript at the bottom (not always, e.g. jQuery import).
  • 53. Lessons learned Css at the top. Javascript at the bottom (not always, e.g. jQuery import). Or remember: $(function (){ //code will execute after page load }),
  • 54. Lessons learned Css at the top. Javascript at the bottom (not always, e.g. jQuery import). Or remember: which is equivalent to: $(function (){ //code will execute after page load }), $(document).ready(function (){});
  • 55. Lessons learned Css at the top. Javascript at the bottom (not always, e.g. jQuery import). Or remember: which is equivalent to: , , your “best friend”. $(function (){ //code will execute after page load }), $(document).ready(function (){});
  • 56. Lessons learned Css at the top. Javascript at the bottom (not always, e.g. jQuery import). Or remember: which is equivalent to: , , your “best friend”. Group, minify and gzip these static resources: $(function (){ //code will execute after page load }), $(document).ready(function (){});
  • 57. Lessons learned Css at the top. Javascript at the bottom (not always, e.g. jQuery import). Or remember: which is equivalent to: , , your “best friend”. Group, minify and gzip these static resources: Asses your page using Yslow You do not need to score 100. Try to follow the suggested best practices as much as possible. $(function (){ //code will execute after page load }), $(document).ready(function (){});
  • 58. Any questions before showing working examples?
  • 59.