SlideShare uma empresa Scribd logo
1 de 34
Baixar para ler offline
jQuery Rescue Adventure
INTRODUCTION TO JQUERY INSIDE SHAREPOINT
Developer Track
Matt Jimison
About Me

   Name      Matt Jimison
 Location    Indianapolis, IN
    Work
    Blog     http://www.mattjimison.com/blog/
   Twitter   @mjimison
Presentation Goals
‱   Introduce the jQuery Library
‱   Discuss How to Incorporate jQuery with SharePoint
‱   Review Highlights of the jQuery API
‱   Demonstrate Using jQuery to Enhance UI
‱   Empower Audience to Utilize jQuery for UI Enhancements
What is


    jQuery is a new kind of JavaScript Library.
jQuery Overview
‱ HTML Document Traversing
‱ Event Handling
‱ Animation
‱ AJAX
‱ Lightweight Footprint (~31KB)
‱ CSS3 Compliant (Supports Selectors)
‱ Cross-Browser (IE, Firefox, Safari, Opera, Chrome)
‱   User Interface Library Built on Top of jQuery
‱   Interactions (Drag, Drop, Resize, Select, Sort)
‱   Widgets (Accordion, Autocomplete, Date, Tabs, Slider, etc
)
‱   Effects (Animation, Show, Hide, Toggle)
‱   Utilities
‱   Touch-Optimized for Tablets and Smart Phones
‱   Supports Multiple Devices
‱   HTML5-based Interface
‱   jQuery / jQueryUI Foundation
‱   Lightweight




                                          7   | SharePoint Saturday Columbus 2011
jQuery and Microsoft
‱   Microsoft contributes to the jQuery Project
‱   Microsoft Product Support includes jQuery
‱   jQuery ships with Visual Studio 2010+
‱   Visual Studio Intellisense Support
Intellisense Demo
Downloading jQuery

‱ Local Copy
   ◩ Download from http://jquery.com/
   ◩ Current and Past Releases
‱ CDN (Content Delivery Network)
   ◩ Google
   ◩ Microsoft
   ◩ jQuery
CDN Considerations

‱ CDN Advantages
  ◩ Quicker Downloads
  ◩ More Parallel Downloads
  ◩ Increased Use of Cache
‱ CDN Disadvantages
  ◩ CDN Outages
  ◩ Loss of Internet Connection
‱ Fallback Option to Load Locally When CDN Fails
Usage Guidance
‱   Use Minified Versions in Production
‱   Consider Local Storage Over CDN for Intranets
‱   Clearly Mark Your Version(s) of jQuery
‱   Test Thoroughly When Upgrading Versions
‱   Be as Unobtrusive as Possible
jQuery Conflict

‱ $ is an Alias for the jQuery function
‱ Many Libraries Use the $
  ◩ CmsSiteManager.js (SharePoint’s Asset Picker)
  ◩ Prototype.js
‱ Conflict Occurs When jQuery Overwrites Other
  Library’s function
‱ Solution: jQuery.NoConflict()
jQuery.noConflict()

‱ Removes jQuery’s use of the $ function
   ◩ Returns Control of $ to Other Libraries
   ◩ jQuery method can be used in place of $
   ◩ Alias jQuery By Capturing Return Value
      ◩ var jQ = jQuery.NoConflict();
   ◩ Pass $ to Ready Method For Scoped Usage
Adding jQuery to SharePoint
‱ MasterPage (Or Page Layout)
    ◩ Adds Unnecessary Overhead On Pages That Don’t Use jQuery (if any)
    ◩ Does not Touch Pages That Do Not Utilize Your MasterPage
‱ Content Editor WebPart (Or Custom WebPart)
    ◩ Becomes a Burden to Manage References and Consistent Use
    ◩ Use the Content Link Versus Inline Code
‱ Delegate Control
    ◩ Alternate Solution Exists in SharePoint 2010 (See next item)
‱ CustomAction (New in SharePoint 2010)
    ◩ Breaks Asset Picker without Additional Configuration
‱ Start.js
    ◩ jQuery Is Not Available At Page Load
Link jQuery to SharePoint Demo
jQuery API Browser
         Available Online:
         http://api.jquery.com/browser/







jQuery Selectors
‱ Derived from CSS 1 – 3
‱ Includes Additional jQuery Conventions
‱ Meta-Characters Need Escaped with 2 Backslashes ()
   ◩ !"#$%&'()*+,./:;<=>?@[]^`{|}~
‱ Common CSS Selector Support
   ◩ ID (#)
   ◩ Class (.)
   ◩ HTML (element)
Attribute Selectors
Description                                Selector
Equals Or Starts With Followed by Hyphen   [name|=“value”]
Contains Text                              [name*=“value”]
Contains Word Delimited by Spaces          [name~=“value”]
Ends With                                  [name$=“value”]
Starts With                                [name^=“value”]
Equals                                     [name=“value”]
Not Equals                                 [name!=“value”]
Has Attribute                              [name]
Multiple Attributes                        [name=“value”][name2=“value2”]
Basic and Child Filters
Description                        Selector
Currently Animating                :animated
Element at Given Index             :eq()
Even or Odd Elements in Results    :even, :odd
First or Last Element in Result    :first, :last
Currently Focused                  :focus
Greater Or Less than Given Index   :gt(), :lt()
Header Elements                    :header
Elements That Do Not Match         :not()
First or Last Child                :first-child, :last-child
Child at Given Index               :nth-child()
Only Children                      :only-child
Additional Selectors
Description                         Selector
Contains Content (case-sensitive)   :contains()
Empty Element                       :empty
Has An Element                      :has()
Parent Elements                     :parent
Selector Examples
Find ASP.Net Control Value (Works Around Control ID)
$("[id$='MyControl']").val()

Links With ‘Click here’ Inside Text
$(“a:contains(‘Click here’)”).css(“font-size”, “1.2em”)

Odd Rows on Table
$(“tr:odd”).addClass(“AlternateRow”)

SharePoint Field Control
var myField = $(“input[title=‘My Field’]”)
Manipulation
Description                              Method
Adding, Removing, Toggling CSS Classes   addClass(), removeClass(), toggleClass()
Adding Content                           .after(), .insertAfter(), .before(), .insertBefore(),
                                         .append(), .appendTo(), .prepend(),
                                         .prependTo()
Reading and Setting Attributes           .attr(“name”), .attr(“name”, “value”),
                                         .attr({“name1”: “value1”, “name2”: “value2”})

Reading and Setting CSS Styles           .css(“name”), .css(“name”, “value”),
                                         .css({“name1”: “value1”, “name2”: “value2”})

Reading and Setting Form Values          .val(), .val(“newvalue”)
Reading and Setting Text                 .text(), .text(“newvalue”)
Reading and Setting HTML                 .html(), .html(“<strong>newvalue</strong>”)
Wrapping Elements                        .wrap(), .wrapAll(), .wrapInner()
Removing Elements                        .remove(), .empty(), .detach(), .unwrap()
Manipulation Examples
Set SharePoint Field Control
$(“input[title=‘My Field’]”).val(“My New Value”);

Wrap Set of DIVs
$(“div.Item”).wrapAll(“<div class=‘ParentItem’ />”);

Toggle CSS Class
$(“div.Item”).toggleClass(“Highlighted”);

Set CSS
$(“#MyDiv”).css({“background”: “green”, “padding”: “5px”});
Traversal
Description                       Method
Loop through all items            .each()
Add Elements to Current Results   .add()
Filter Results                    .filter()
Filter Descendants                .find()
Map to a New Result               .map()
Children Selector                 .children()
Parent Selectors                  .parent(), .offsetParent(), .parentsUntil()
Sibling Selectors                 .siblings(), .next(), .prev(), .nextUntil(),
                                  .prevUntil()
Traversal Examples
Count Words in Each Paragraph
$("p").each(function(i) { $(this).append(" (" + $(this).text().split(' ').length + "
words)"); });


Wrap First Paragraph’s Siblings
$(“p:first”).siblings().wrapAll(“<div style=‘background:green’ />”);


Find Next Unordered Lists Following First Occurrence
$("ul:first").next("ul").css("background","yellow");
Events
Description                      Method
Generic Bind                     .bind(“method”, function() { })
Bind Event Once                  .one(“method”, function() { })
Bind Shortcuts                   .click(), .change(), .select(), .mouseover(),
                                 .mouseout(), .blur()
Hover (Mouseover and Mouseout)   .hover(function() { }, function() { })
Trigger Event                    .trigger(“method”)
Event Examples
Click Event On Paragraphs
$(“p”).click(function(event) { $(this).css(“background”, “yellow”)
});


Hover Events
$(“p”).hover(
       function(event) { $(this).addClass(“Highlight”); },
       function(event) { $(this).removeClass(“Highlight”); }
);
Developer Tools
Browser             Description

Chrome              Built-In Developer Tools (F12)



Firefox             Firebug (Separate Add-On)



Internet Explorer   Built-In Developer Tools (F12)
Console Demo
jQuery in Action

‱ Show / Hide Animations with Content Query
‱ Link Behaviors
‱ SharePoint Page Manipulation
‱ Announcements Slideshow
jQuery in Action Demo
Resources
‱ jQuery
‱ ScottGu: jQuery and Microsoft
‱ Jon Galloway: Using CDN Hosted jQuery with a
  Local Fall-back Copy
‱ Find External Links with jQuery
‱ jQuerify
‱ SlideDeck
Please Thank Our Sponsors

Mais conteĂșdo relacionado

Mais procurados

Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuerymanugoel2003
 
jQuery for beginners
jQuery for beginnersjQuery for beginners
jQuery for beginnersSiva Arunachalam
 
jQuery Introduction
jQuery IntroductionjQuery Introduction
jQuery IntroductionArwid Bancewicz
 
SharePointfest Denver - A jQuery Primer for SharePoint
SharePointfest Denver -  A jQuery Primer for SharePointSharePointfest Denver -  A jQuery Primer for SharePoint
SharePointfest Denver - A jQuery Primer for SharePointMarc D Anderson
 
JQuery
JQueryJQuery
JQueryDevTalk
 
jQuery Presentation
jQuery PresentationjQuery Presentation
jQuery PresentationRod Johnson
 
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
 
Iniciando com jquery
Iniciando com jqueryIniciando com jquery
Iniciando com jqueryDanilo Sousa
 
jQuery Loves Developers - Oredev 2009
jQuery Loves Developers - Oredev 2009jQuery Loves Developers - Oredev 2009
jQuery Loves Developers - Oredev 2009Remy Sharp
 
J query introduction
J query introductionJ query introduction
J query introductionSMS_VietNam
 

Mais procurados (20)

Jquery
JqueryJquery
Jquery
 
JQuery introduction
JQuery introductionJQuery introduction
JQuery introduction
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
 
Jquery-overview
Jquery-overviewJquery-overview
Jquery-overview
 
J query
J queryJ query
J query
 
jQuery for beginners
jQuery for beginnersjQuery for beginners
jQuery for beginners
 
J query1
J query1J query1
J query1
 
Jquery
JqueryJquery
Jquery
 
jQuery Introduction
jQuery IntroductionjQuery Introduction
jQuery Introduction
 
D3.js and SVG
D3.js and SVGD3.js and SVG
D3.js and SVG
 
SharePointfest Denver - A jQuery Primer for SharePoint
SharePointfest Denver -  A jQuery Primer for SharePointSharePointfest Denver -  A jQuery Primer for SharePoint
SharePointfest Denver - A jQuery Primer for SharePoint
 
jQuery
jQueryjQuery
jQuery
 
JQuery
JQueryJQuery
JQuery
 
Jquery 3
Jquery 3Jquery 3
Jquery 3
 
jQuery Presentation
jQuery PresentationjQuery Presentation
jQuery Presentation
 
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
 
Iniciando com jquery
Iniciando com jqueryIniciando com jquery
Iniciando com jquery
 
jQuery Loves Developers - Oredev 2009
jQuery Loves Developers - Oredev 2009jQuery Loves Developers - Oredev 2009
jQuery Loves Developers - Oredev 2009
 
J query introduction
J query introductionJ query introduction
J query introduction
 
Learn css3
Learn css3Learn css3
Learn css3
 

Destaque

Wcm sp-2013
Wcm sp-2013Wcm sp-2013
Wcm sp-2013Allegient
 
Improving Focus, Predictability, and Team Morale on Projects
Improving Focus, Predictability, and Team Morale on ProjectsImproving Focus, Predictability, and Team Morale on Projects
Improving Focus, Predictability, and Team Morale on ProjectsJoe Cooper
 
SPSDenver - SharePoint & jQuery - What I wish I would have known
SPSDenver - SharePoint & jQuery - What I wish I would have knownSPSDenver - SharePoint & jQuery - What I wish I would have known
SPSDenver - SharePoint & jQuery - What I wish I would have knownMark Rackley
 
Business Process Training, Tips and Tricks for Visio 2013
Business Process Training, Tips and Tricks for Visio 2013Business Process Training, Tips and Tricks for Visio 2013
Business Process Training, Tips and Tricks for Visio 2013Allegient
 
The Near Future of CSS
The Near Future of CSSThe Near Future of CSS
The Near Future of CSSRachel Andrew
 
Classroom Management Tips for Kids and Adolescents
Classroom Management Tips for Kids and AdolescentsClassroom Management Tips for Kids and Adolescents
Classroom Management Tips for Kids and AdolescentsShelly Sanchez Terrell
 
The Buyer's Journey - by Chris Lema
The Buyer's Journey - by Chris LemaThe Buyer's Journey - by Chris Lema
The Buyer's Journey - by Chris LemaChris Lema
 

Destaque (7)

Wcm sp-2013
Wcm sp-2013Wcm sp-2013
Wcm sp-2013
 
Improving Focus, Predictability, and Team Morale on Projects
Improving Focus, Predictability, and Team Morale on ProjectsImproving Focus, Predictability, and Team Morale on Projects
Improving Focus, Predictability, and Team Morale on Projects
 
SPSDenver - SharePoint & jQuery - What I wish I would have known
SPSDenver - SharePoint & jQuery - What I wish I would have knownSPSDenver - SharePoint & jQuery - What I wish I would have known
SPSDenver - SharePoint & jQuery - What I wish I would have known
 
Business Process Training, Tips and Tricks for Visio 2013
Business Process Training, Tips and Tricks for Visio 2013Business Process Training, Tips and Tricks for Visio 2013
Business Process Training, Tips and Tricks for Visio 2013
 
The Near Future of CSS
The Near Future of CSSThe Near Future of CSS
The Near Future of CSS
 
Classroom Management Tips for Kids and Adolescents
Classroom Management Tips for Kids and AdolescentsClassroom Management Tips for Kids and Adolescents
Classroom Management Tips for Kids and Adolescents
 
The Buyer's Journey - by Chris Lema
The Buyer's Journey - by Chris LemaThe Buyer's Journey - by Chris Lema
The Buyer's Journey - by Chris Lema
 

Semelhante a jQuery Rescue Adventure

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 Presentasion
jQuery PresentasionjQuery Presentasion
jQuery PresentasionMohammad Usman
 
jQuery - Tips And Tricks
jQuery - Tips And TricksjQuery - Tips And Tricks
jQuery - Tips And TricksLester Lievens
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQueryGunjan Kumar
 
Intro to jQuery
Intro to jQueryIntro to jQuery
Intro to jQueryAlan Hecht
 
Introduzione JQuery
Introduzione JQueryIntroduzione JQuery
Introduzione JQueryorestJump
 
jQuery in the [Aol.] Enterprise
jQuery in the [Aol.] EnterprisejQuery in the [Aol.] Enterprise
jQuery in the [Aol.] EnterpriseDave Artz
 
SEF2013 - A jQuery Primer for SharePoint
SEF2013 - A jQuery Primer for SharePointSEF2013 - A jQuery Primer for SharePoint
SEF2013 - A jQuery Primer for SharePointMarc D Anderson
 
Web Development Course - JQuery by RSOLUTIONS
Web Development Course - JQuery by RSOLUTIONSWeb Development Course - JQuery by RSOLUTIONS
Web Development Course - JQuery by RSOLUTIONSRSolutions
 
J query b_dotnet_ug_meet_12_may_2012
J query b_dotnet_ug_meet_12_may_2012J query b_dotnet_ug_meet_12_may_2012
J query b_dotnet_ug_meet_12_may_2012ghnash
 
JQuery Overview
JQuery OverviewJQuery Overview
JQuery OverviewMahmoud Tolba
 
Kick start with j query
Kick start with j queryKick start with j query
Kick start with j queryMd. Ziaul Haq
 
Unobtrusive javascript with jQuery
Unobtrusive javascript with jQueryUnobtrusive javascript with jQuery
Unobtrusive javascript with jQueryAngel Ruiz
 
J Query The Write Less Do More Javascript Library
J Query   The Write Less Do More Javascript LibraryJ Query   The Write Less Do More Javascript Library
J Query The Write Less Do More Javascript Libraryrsnarayanan
 
Introduction to jQuery - The basics
Introduction to jQuery - The basicsIntroduction to jQuery - The basics
Introduction to jQuery - The basicsMaher Hossain
 
Knockoutjs UG meeting presentation
Knockoutjs UG meeting presentationKnockoutjs UG meeting presentation
Knockoutjs UG meeting presentationValdis Iljuconoks
 

Semelhante a jQuery Rescue Adventure (20)

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 Presentasion
jQuery PresentasionjQuery Presentasion
jQuery Presentasion
 
jQuery - Tips And Tricks
jQuery - Tips And TricksjQuery - Tips And Tricks
jQuery - Tips And Tricks
 
jQuery
jQueryjQuery
jQuery
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
 
J Query Public
J Query PublicJ Query Public
J Query Public
 
Intro to jQuery
Intro to jQueryIntro to jQuery
Intro to jQuery
 
Introduzione JQuery
Introduzione JQueryIntroduzione JQuery
Introduzione JQuery
 
jQuery in the [Aol.] Enterprise
jQuery in the [Aol.] EnterprisejQuery in the [Aol.] Enterprise
jQuery in the [Aol.] Enterprise
 
SEF2013 - A jQuery Primer for SharePoint
SEF2013 - A jQuery Primer for SharePointSEF2013 - A jQuery Primer for SharePoint
SEF2013 - A jQuery Primer for SharePoint
 
Web Development Course - JQuery by RSOLUTIONS
Web Development Course - JQuery by RSOLUTIONSWeb Development Course - JQuery by RSOLUTIONS
Web Development Course - JQuery by RSOLUTIONS
 
J query b_dotnet_ug_meet_12_may_2012
J query b_dotnet_ug_meet_12_may_2012J query b_dotnet_ug_meet_12_may_2012
J query b_dotnet_ug_meet_12_may_2012
 
JQuery Overview
JQuery OverviewJQuery Overview
JQuery Overview
 
JavaScript JQUERY AJAX
JavaScript JQUERY AJAXJavaScript JQUERY AJAX
JavaScript JQUERY AJAX
 
Kick start with j query
Kick start with j queryKick start with j query
Kick start with j query
 
Unobtrusive javascript with jQuery
Unobtrusive javascript with jQueryUnobtrusive javascript with jQuery
Unobtrusive javascript with jQuery
 
JQuery introduction
JQuery introductionJQuery introduction
JQuery introduction
 
J Query The Write Less Do More Javascript Library
J Query   The Write Less Do More Javascript LibraryJ Query   The Write Less Do More Javascript Library
J Query The Write Less Do More Javascript Library
 
Introduction to jQuery - The basics
Introduction to jQuery - The basicsIntroduction to jQuery - The basics
Introduction to jQuery - The basics
 
Knockoutjs UG meeting presentation
Knockoutjs UG meeting presentationKnockoutjs UG meeting presentation
Knockoutjs UG meeting presentation
 

Último

Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vĂĄzquez
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 

Último (20)

Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 

jQuery Rescue Adventure

  • 1. jQuery Rescue Adventure INTRODUCTION TO JQUERY INSIDE SHAREPOINT Developer Track Matt Jimison
  • 2. About Me Name Matt Jimison Location Indianapolis, IN Work Blog http://www.mattjimison.com/blog/ Twitter @mjimison
  • 3. Presentation Goals ‱ Introduce the jQuery Library ‱ Discuss How to Incorporate jQuery with SharePoint ‱ Review Highlights of the jQuery API ‱ Demonstrate Using jQuery to Enhance UI ‱ Empower Audience to Utilize jQuery for UI Enhancements
  • 4. What is jQuery is a new kind of JavaScript Library.
  • 5. jQuery Overview ‱ HTML Document Traversing ‱ Event Handling ‱ Animation ‱ AJAX ‱ Lightweight Footprint (~31KB) ‱ CSS3 Compliant (Supports Selectors) ‱ Cross-Browser (IE, Firefox, Safari, Opera, Chrome)
  • 6. ‱ User Interface Library Built on Top of jQuery ‱ Interactions (Drag, Drop, Resize, Select, Sort) ‱ Widgets (Accordion, Autocomplete, Date, Tabs, Slider, etc
) ‱ Effects (Animation, Show, Hide, Toggle) ‱ Utilities
  • 7. ‱ Touch-Optimized for Tablets and Smart Phones ‱ Supports Multiple Devices ‱ HTML5-based Interface ‱ jQuery / jQueryUI Foundation ‱ Lightweight 7 | SharePoint Saturday Columbus 2011
  • 8. jQuery and Microsoft ‱ Microsoft contributes to the jQuery Project ‱ Microsoft Product Support includes jQuery ‱ jQuery ships with Visual Studio 2010+ ‱ Visual Studio Intellisense Support
  • 10. Downloading jQuery ‱ Local Copy ◩ Download from http://jquery.com/ ◩ Current and Past Releases ‱ CDN (Content Delivery Network) ◩ Google ◩ Microsoft ◩ jQuery
  • 11. CDN Considerations ‱ CDN Advantages ◩ Quicker Downloads ◩ More Parallel Downloads ◩ Increased Use of Cache ‱ CDN Disadvantages ◩ CDN Outages ◩ Loss of Internet Connection ‱ Fallback Option to Load Locally When CDN Fails
  • 12. Usage Guidance ‱ Use Minified Versions in Production ‱ Consider Local Storage Over CDN for Intranets ‱ Clearly Mark Your Version(s) of jQuery ‱ Test Thoroughly When Upgrading Versions ‱ Be as Unobtrusive as Possible
  • 13. jQuery Conflict ‱ $ is an Alias for the jQuery function ‱ Many Libraries Use the $ ◩ CmsSiteManager.js (SharePoint’s Asset Picker) ◩ Prototype.js ‱ Conflict Occurs When jQuery Overwrites Other Library’s function ‱ Solution: jQuery.NoConflict()
  • 14. jQuery.noConflict() ‱ Removes jQuery’s use of the $ function ◩ Returns Control of $ to Other Libraries ◩ jQuery method can be used in place of $ ◩ Alias jQuery By Capturing Return Value ◩ var jQ = jQuery.NoConflict(); ◩ Pass $ to Ready Method For Scoped Usage
  • 15. Adding jQuery to SharePoint ‱ MasterPage (Or Page Layout) ◩ Adds Unnecessary Overhead On Pages That Don’t Use jQuery (if any) ◩ Does not Touch Pages That Do Not Utilize Your MasterPage ‱ Content Editor WebPart (Or Custom WebPart) ◩ Becomes a Burden to Manage References and Consistent Use ◩ Use the Content Link Versus Inline Code ‱ Delegate Control ◩ Alternate Solution Exists in SharePoint 2010 (See next item) ‱ CustomAction (New in SharePoint 2010) ◩ Breaks Asset Picker without Additional Configuration ‱ Start.js ◩ jQuery Is Not Available At Page Load
  • 16. Link jQuery to SharePoint Demo
  • 17. jQuery API Browser Available Online: http://api.jquery.com/browser/   
  • 18. jQuery Selectors ‱ Derived from CSS 1 – 3 ‱ Includes Additional jQuery Conventions ‱ Meta-Characters Need Escaped with 2 Backslashes () ◩ !"#$%&'()*+,./:;<=>?@[]^`{|}~ ‱ Common CSS Selector Support ◩ ID (#) ◩ Class (.) ◩ HTML (element)
  • 19. Attribute Selectors Description Selector Equals Or Starts With Followed by Hyphen [name|=“value”] Contains Text [name*=“value”] Contains Word Delimited by Spaces [name~=“value”] Ends With [name$=“value”] Starts With [name^=“value”] Equals [name=“value”] Not Equals [name!=“value”] Has Attribute [name] Multiple Attributes [name=“value”][name2=“value2”]
  • 20. Basic and Child Filters Description Selector Currently Animating :animated Element at Given Index :eq() Even or Odd Elements in Results :even, :odd First or Last Element in Result :first, :last Currently Focused :focus Greater Or Less than Given Index :gt(), :lt() Header Elements :header Elements That Do Not Match :not() First or Last Child :first-child, :last-child Child at Given Index :nth-child() Only Children :only-child
  • 21. Additional Selectors Description Selector Contains Content (case-sensitive) :contains() Empty Element :empty Has An Element :has() Parent Elements :parent
  • 22. Selector Examples Find ASP.Net Control Value (Works Around Control ID) $("[id$='MyControl']").val() Links With ‘Click here’ Inside Text $(“a:contains(‘Click here’)”).css(“font-size”, “1.2em”) Odd Rows on Table $(“tr:odd”).addClass(“AlternateRow”) SharePoint Field Control var myField = $(“input[title=‘My Field’]”)
  • 23. Manipulation Description Method Adding, Removing, Toggling CSS Classes addClass(), removeClass(), toggleClass() Adding Content .after(), .insertAfter(), .before(), .insertBefore(), .append(), .appendTo(), .prepend(), .prependTo() Reading and Setting Attributes .attr(“name”), .attr(“name”, “value”), .attr({“name1”: “value1”, “name2”: “value2”}) Reading and Setting CSS Styles .css(“name”), .css(“name”, “value”), .css({“name1”: “value1”, “name2”: “value2”}) Reading and Setting Form Values .val(), .val(“newvalue”) Reading and Setting Text .text(), .text(“newvalue”) Reading and Setting HTML .html(), .html(“<strong>newvalue</strong>”) Wrapping Elements .wrap(), .wrapAll(), .wrapInner() Removing Elements .remove(), .empty(), .detach(), .unwrap()
  • 24. Manipulation Examples Set SharePoint Field Control $(“input[title=‘My Field’]”).val(“My New Value”); Wrap Set of DIVs $(“div.Item”).wrapAll(“<div class=‘ParentItem’ />”); Toggle CSS Class $(“div.Item”).toggleClass(“Highlighted”); Set CSS $(“#MyDiv”).css({“background”: “green”, “padding”: “5px”});
  • 25. Traversal Description Method Loop through all items .each() Add Elements to Current Results .add() Filter Results .filter() Filter Descendants .find() Map to a New Result .map() Children Selector .children() Parent Selectors .parent(), .offsetParent(), .parentsUntil() Sibling Selectors .siblings(), .next(), .prev(), .nextUntil(), .prevUntil()
  • 26. Traversal Examples Count Words in Each Paragraph $("p").each(function(i) { $(this).append(" (" + $(this).text().split(' ').length + " words)"); }); Wrap First Paragraph’s Siblings $(“p:first”).siblings().wrapAll(“<div style=‘background:green’ />”); Find Next Unordered Lists Following First Occurrence $("ul:first").next("ul").css("background","yellow");
  • 27. Events Description Method Generic Bind .bind(“method”, function() { }) Bind Event Once .one(“method”, function() { }) Bind Shortcuts .click(), .change(), .select(), .mouseover(), .mouseout(), .blur() Hover (Mouseover and Mouseout) .hover(function() { }, function() { }) Trigger Event .trigger(“method”)
  • 28. Event Examples Click Event On Paragraphs $(“p”).click(function(event) { $(this).css(“background”, “yellow”) }); Hover Events $(“p”).hover( function(event) { $(this).addClass(“Highlight”); }, function(event) { $(this).removeClass(“Highlight”); } );
  • 29. Developer Tools Browser Description Chrome Built-In Developer Tools (F12) Firefox Firebug (Separate Add-On) Internet Explorer Built-In Developer Tools (F12)
  • 31. jQuery in Action ‱ Show / Hide Animations with Content Query ‱ Link Behaviors ‱ SharePoint Page Manipulation ‱ Announcements Slideshow
  • 33. Resources ‱ jQuery ‱ ScottGu: jQuery and Microsoft ‱ Jon Galloway: Using CDN Hosted jQuery with a Local Fall-back Copy ‱ Find External Links with jQuery ‱ jQuerify ‱ SlideDeck
  • 34. Please Thank Our Sponsors