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 (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

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 Intro to jQuery in SharePoint - Enhance UI

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 - 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
 
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 Intro to jQuery in SharePoint - Enhance UI (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

Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
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
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
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
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
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
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 

Último (20)

Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
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
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
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
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
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
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
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
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 

Intro to jQuery in SharePoint - Enhance UI

  • 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