SlideShare a Scribd company logo
1 of 18
Download to read offline
JavaScript, jQuery & AJAX
What is JavaScript?
• An interpreted programming language with
  object oriented capabilities.
• Not Java!
  – Originally called LiveScript, changed to JavaScript as
    a marketing ploy by Sun and Netscape. Can also be
    referred to as ECMAScript.
• Not simple!
  – Although it is loosely typed and can be used by web
    developers in a “cookbook” fashion (think image
    rollovers), JavaScript is a fully featured programming
    language with many advanced features.
Client Side JavaScript
• When JavaScript is embedded in a web browser,
  it is referred to as Client Side JavaScript.
• Contains an extended set of functionality to
  interface with the web browser DOM (Document
  Object Model).
• Objects, such as window and document, and
  functions, like event detection and handling, are
  included in Client Side JavaScript.
What is jQuery?
• A framework for Client Side JavaScript.
• Frameworks provide useful alternatives for
  common programming tasks, creating
  functionality which may not be available or
  cumbersome to use within a language.
• An open source project, maintained by a
  group of developers, with a very active
  support base and thorough, well written
  documentation.
What jQuery is not…
• A substitute for knowing JavaScript
   – jQuery is extraordinarily useful, but you should still
     know how JavaScript works and how to use it
     correctly. This means more than Googling a tutorial
     and calling yourself an expert.
• A solve all
   – There is still plenty of functionality built into JavaScript
     that should be utilized! Don’t turn every project into a
     quest to ‘jQuery-ize’ the problem, use jQuery where it
     makes sense. Create solutions in environments
     where they belong.
What is available with jQuery?
• Cross browser            • JavaScript animation
  support and detection    • Hundreds of plugins
• AJAX functions             for pre-built user
• CSS functions              interfaces, advanced
                             animations, form
• DOM manipulation           validation, etc
• DOM transversal          • Expandable
• Attribute manipulation     functionality using
• Event detection and        custom plugins
  handling                 • Small foot print
jQuery Syntax
                     $.func(…);
                           or
$(selector).func1(…).func2(…).funcN(…);

        $ jQuery Object, can be used instead of jQuery
  selector Selector syntax, many different selectors allowed
     func Chainable, most functions return a jQuery object
      (…) Function parameters
The jQuery/$ Object
• Represented by both $ and jQuery
  – To use jQuery only, use jQuery.noConflict(),
    for other frameworks that use $
• By default, represents the jQuery object.
  When combined with a selector, can
  represent multiple DOM Elements, see
  next slide.
• Used with all jQuery functions.
jQuery Selectors
•   $( html )                         •   $( expr, context )
    Create DOM elements on-the-           This function accepts a string
    fly from the provided String of       containing a CSS or basic
    raw HTML.                             XPath selector which is then
                                          used to match a set of
                                          elements. Default context is
•   $( elems )                            document. Used most often for
    Wrap jQuery functionality             DOM transversal.
    around single or multiple DOM
    Elements.                         •   Selectors will return a jQuery
                                          object, which can contain one
                                          or more elements, or contain
•   $( fn )                               no elements at all.
    A shorthand for $
    (document).ready(), allowing
    you to bind a function to be
    executed when the DOM
    document has finished loading.
jQuery Selector Examples
•   $( html )
     – $(‘<p><a href=“index.html”>Click here!</a></p>’)


•   $ ( elems )
     – $(document), $(window), $(this)


     –    $(document.getElementsByTagName(“p”))


•   $ ( fn )
     –    $(function() { alert(“Hello, World!”) });


•   $ ( expr, context )
     –    $(“p”), $(“form”), $(“input”)


     –    $(“p#content”), $(“#content”), $(“.brandnew”), $(“p span.brandnew:first-child, #content”)


     –    $(“p/span”), $(“p/span[@class=brandnew]”), $(p/span:first), $(p:first/span:even)


     –    $(“input:checkbox[@checked]”), $(“div:visible p[a]”)
jQuery Functions
• Attached to the jQuery object or chained
  off of a selector statement.
• Most functions return the jQuery object
  they were originally passed, so you can
  perform many actions in a single line.
• The same function can perform an entirely
  different action based on the number and
  type of parameters.
jQuery Usage Example

 $(“li:odd”).prepend(‘<span>Changed</span>’).css({background:“red”});

<ul>                  <ul>                        <ul>
  <li>                  <li>                        <li style=“background:red;”>
     First item            <span>Changed</span>        <span>Changed</span>
  </li>                    First item                  First item
  <li>                  </li>                       </li>
     Second item        <li>                        <li>
  </li>                    Second item                 Second item
  <li>                  </li>                       </li>
     Third item         <li>                        <li style=“background:red;”>
  </li>                    <span>Changed</span>        <span>Changed</span>
</ul>                      Third item                  Third item
                        </li>                       </li>
                      </ul>                       </ul>
jQuery Usage Example
   $(“div:hidden”).find(“.foo”).empty().text(“Changed”).end().show();

<div>                        <div>                        <div>
  <span class=“foo”>           <span class=“foo”>           <span class=“foo”>
    Some text                    Some text                    Some text
  </span>                      </span>                      </span>
</div>                       </div>                       </div>
<div style=“display:none”>   <div style=“display:none”>   <div style=“display:none”>
  <span>                       <span>                       <span>
    More text                    More text                    More text
  </span>                      </span>                      </span>
  <span class=“foo”>           <span class=“foo”>           <span class=“foo”>
    Goodbye cruel world.         Goodbye cruel world.       </span>
  </span>                      </span>                    </div>
</div>                       </div>



<div>                        <div>                        <div>
  <span class=“foo”>           <span class=“foo”>           <span class=“foo”>
    Some text                    Some text                    Some text
  </span>                      </span>                      </span>
</div>                       </div>                       </div>
<div style=“display:none”>   <div style=“display:none”>   <div style=“display:block”>
  <span>                       <span>                       <span>
    More text                    More text                    More text
  </span>                      </span>                      </span>
  <span class=“foo”>           <span class=“foo”>           <span class=“foo”>
    Changed                      Changed                      Changed
  </span>                      </span>                      </span>
</div>                       </div>                       </div>
jQuery Advanced Example
$(“span.none”).click(                                           <div>
   function(){                                                    <span class=“all”>Select All</span>
     $(this).siblings(“:checkbox”).removeAttr(“checked”);
   }                                                              <span class=“none”>Select None</span>
);                                                                <input name=“chk1” type=“checkbox”/>
                                                                  <input name=“chk2” type=“checkbox”/>
$(“span.all”).click(                                              <input name=“chk3” type=“checkbox”/>
   function(){
     $(this).siblings(“:checkbox”).attr(“checked”,“checked”);   </div>
   }                                                            <div>
);
                                                                  <span class=“all”>Select All</span>
                                                                  <span class=“none”>Select None</span>

                          or                                      <input name=“chk4” type=“checkbox”/>
                                                                  <input name=“chk5” type=“checkbox”/>
                                                                  <input name=“chk6” type=“checkbox”/>
$(“span”).click(                                                </div>
   function(){
     if($(this).text()==“Select All”))
     $(this).siblings(“:checkbox”).attr(“checked”,“checked”);
     else if ($(this).attr(“class”)==“none”)
     $(this).siblings(“:checkbox”).removeAttr(“checked”);
   }
);
jQuery & AJAX
• jQuery has a series of functions which
  provide a common interface for AJAX, no
  matter what browser you are using.
• Most of the upper level AJAX functions
  have a common layout:
  – $.func(url[,params][,callback]), [ ] optional
     • url: string representing server target
     • params: names and values to send to server
     • callback: function executed on successful
       communication.
jQuery AJAX Functions
•   $.func(url[,params][,callback])   •   $.ajax, $.ajaxSetup
     –   $.get                             –   async
     –   $.getJSON                         –   beforeSend
                                           –   complete
     –   $.getIfModified
                                           –   contentType
     –   $.getScript                       –   data
     –   $.post                            –   dataType
                                           –   error
•   $(selector), inject HTML               –   global
     – load                                –   ifModified
                                           –   processData
     – loadIfModified                      –   success
                                           –   timeout
•   $(selector), ajaxSetup alts            –   type
     –   ajaxComplete                      –   url
     –   ajaxError
     –   ajaxSend
     –   ajaxStart
     –   ajaxStop
     –   ajaxSuccess
jQuery AJAX Example
<html>                                                   <?php
                                                         $output = ‘’;
<head>
<title>AJAX Demo</title>                                 switch($_REQUEST[‘in’]) {
                                                           case ‘hello’:
<script type=“text/javascript” src=“jquery.js”>
                                                             $output = ‘Hello back.’;
</script>                                                    break;
                                                           case ‘foo’:
<script type=“text/javascript”>
                                                             $output = ‘Foo you, too.’;
var cnt = 0;                                                 break;
                                                           case ‘bar’:
$(function(){
                                                             $output = ‘Where Andy Capp can be found.’;
  $.ajaxSettings({                                           break;
                                                           case ‘foobar’:
      error:function(){alert(“Communication error!”);}
                                                             $output = ‘This is German, right?’;
  });                                                        break;
                                                           default:
  $(“:button”).click(function(){
                                                             $output = ‘Unrecognized string.’;
      var input = {in:$(“:textbox”).val(),count:cnt};    }
      $.getJSON(“ajax.php”,input,function(json){
                                                         $count = $_REQUEST[‘count’]+1;
        cnt = json.cnt;
                                                         echo json_encode(
        $(“.cnt”).text(cnt)
                                                            array(
        $(“.msg”).text(json.out);                             ‘out’ => $output,
                                                              ‘cnt’ => $count
      });
                                                            )
  });                                                    );
});
                                                         exit;
</script>                                                ?>
</head>
<body>
<p>
jQuery Resources
•   Project website
     – http://www.jquery.com
•   Learning Center
     – http://docs.jquery.com/Tutorials
     – http://www.learningjquery.com/
     – http://15daysofjquery.com/
•   Support
     – http://docs.jquery.com/Discussion
     – http://www.nabble.com/JQuery-f15494.html mailing list archive
     – irc.freenode.net irc room: #jquery
•   Documentation
     – http://docs.jquery.com/Main_Page
     – http://www.visualjquery.com
     – http://jquery.bassistance.de/api-browser/
•   jQuery Success Stories
     – http://docs.jquery.com/Sites_Using_jQuery

More Related Content

What's hot (19)

Jquery-overview
Jquery-overviewJquery-overview
Jquery-overview
 
Learning jQuery in 30 minutes
Learning jQuery in 30 minutesLearning jQuery in 30 minutes
Learning jQuery in 30 minutes
 
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
 
J query1
J query1J query1
J query1
 
jQuery Presentasion
jQuery PresentasionjQuery Presentasion
jQuery Presentasion
 
J query
J queryJ query
J query
 
A Short Introduction To jQuery
A Short Introduction To jQueryA Short Introduction To jQuery
A Short Introduction To jQuery
 
jQuery
jQueryjQuery
jQuery
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
 
jQuery introduction
jQuery introductionjQuery introduction
jQuery introduction
 
J query training
J query trainingJ query training
J query training
 
Write Less Do More
Write Less Do MoreWrite Less Do More
Write Less Do More
 
JQuery introduction
JQuery introductionJQuery introduction
JQuery introduction
 
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
 
jQuery Selectors
jQuery SelectorsjQuery Selectors
jQuery Selectors
 
Jquery
JqueryJquery
Jquery
 
User Interface Development with jQuery
User Interface Development with jQueryUser Interface Development with jQuery
User Interface Development with jQuery
 
J query lecture 1
J query lecture 1J query lecture 1
J query lecture 1
 

Viewers also liked

Jeni J2 Me Bab01 Pengembangan Aplikasi Mobile
Jeni J2 Me Bab01 Pengembangan Aplikasi MobileJeni J2 Me Bab01 Pengembangan Aplikasi Mobile
Jeni J2 Me Bab01 Pengembangan Aplikasi MobileIndividual Consultants
 
Jeni Intro1 Bab09 Bekerja Dengan Java Class Library
Jeni Intro1 Bab09 Bekerja Dengan Java Class LibraryJeni Intro1 Bab09 Bekerja Dengan Java Class Library
Jeni Intro1 Bab09 Bekerja Dengan Java Class LibraryIndividual Consultants
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />tutorialsruby
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />tutorialsruby
 
indesign_cs3_scripting_tutorial
indesign_cs3_scripting_tutorialindesign_cs3_scripting_tutorial
indesign_cs3_scripting_tutorialtutorialsruby
 
Konsep dasar kewirausahaan
Konsep dasar kewirausahaanKonsep dasar kewirausahaan
Konsep dasar kewirausahaanKoak Koak
 

Viewers also liked (7)

Jeni J2 Me Bab01 Pengembangan Aplikasi Mobile
Jeni J2 Me Bab01 Pengembangan Aplikasi MobileJeni J2 Me Bab01 Pengembangan Aplikasi Mobile
Jeni J2 Me Bab01 Pengembangan Aplikasi Mobile
 
Jeni Intro1 Bab09 Bekerja Dengan Java Class Library
Jeni Intro1 Bab09 Bekerja Dengan Java Class LibraryJeni Intro1 Bab09 Bekerja Dengan Java Class Library
Jeni Intro1 Bab09 Bekerja Dengan Java Class Library
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />
 
XML-Javascript
XML-JavascriptXML-Javascript
XML-Javascript
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />
 
indesign_cs3_scripting_tutorial
indesign_cs3_scripting_tutorialindesign_cs3_scripting_tutorial
indesign_cs3_scripting_tutorial
 
Konsep dasar kewirausahaan
Konsep dasar kewirausahaanKonsep dasar kewirausahaan
Konsep dasar kewirausahaan
 

Similar to jquery

Advanced JQuery Mobile tutorial with Phonegap
Advanced JQuery Mobile tutorial with Phonegap Advanced JQuery Mobile tutorial with Phonegap
Advanced JQuery Mobile tutorial with Phonegap Rakesh Jha
 
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
 
jQuery Learning
jQuery LearningjQuery Learning
jQuery LearningUzair Ali
 
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
 
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
 
Intro to jQuery
Intro to jQueryIntro to jQuery
Intro to jQueryAlan Hecht
 
GDI Seattle - Intro to JavaScript Class 4
GDI Seattle - Intro to JavaScript Class 4GDI Seattle - Intro to JavaScript Class 4
GDI Seattle - Intro to JavaScript Class 4Heather Rock
 
Learning About JavaScript (…and its little buddy, JQuery!)
Learning About JavaScript (…and its little buddy, JQuery!)Learning About JavaScript (…and its little buddy, JQuery!)
Learning About JavaScript (…and its little buddy, JQuery!)Julie Meloni
 
SharePoint & jQuery Guide - SPSNashville 2014
SharePoint & jQuery Guide - SPSNashville 2014SharePoint & jQuery Guide - SPSNashville 2014
SharePoint & jQuery Guide - SPSNashville 2014Mark Rackley
 
jQuery: Tips, tricks and hints for better development and Performance
jQuery: Tips, tricks and hints for better development and PerformancejQuery: Tips, tricks and hints for better development and Performance
jQuery: Tips, tricks and hints for better development and PerformanceJonas De Smet
 
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
 
Prototype & jQuery
Prototype & jQueryPrototype & jQuery
Prototype & jQueryRemy Sharp
 
Jquery tutorial
Jquery tutorialJquery tutorial
Jquery tutorialBui Kiet
 
BITM3730 10-4.pptx
BITM3730 10-4.pptxBITM3730 10-4.pptx
BITM3730 10-4.pptxMattMarino13
 

Similar to jquery (20)

Jquery
JqueryJquery
Jquery
 
Advanced JQuery Mobile tutorial with Phonegap
Advanced JQuery Mobile tutorial with Phonegap Advanced JQuery Mobile tutorial with Phonegap
Advanced JQuery Mobile tutorial with Phonegap
 
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...
 
jQuery Learning
jQuery LearningjQuery Learning
jQuery Learning
 
Jquery 2
Jquery 2Jquery 2
Jquery 2
 
jQuery Basic API
jQuery Basic APIjQuery Basic API
jQuery Basic API
 
Java script
Java scriptJava script
Java script
 
Jquery fundamentals
Jquery fundamentalsJquery fundamentals
Jquery fundamentals
 
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
 
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
 
Intro to jQuery
Intro to jQueryIntro to jQuery
Intro to jQuery
 
jQuery basics
jQuery basicsjQuery basics
jQuery basics
 
GDI Seattle - Intro to JavaScript Class 4
GDI Seattle - Intro to JavaScript Class 4GDI Seattle - Intro to JavaScript Class 4
GDI Seattle - Intro to JavaScript Class 4
 
Learning About JavaScript (…and its little buddy, JQuery!)
Learning About JavaScript (…and its little buddy, JQuery!)Learning About JavaScript (…and its little buddy, JQuery!)
Learning About JavaScript (…and its little buddy, JQuery!)
 
SharePoint & jQuery Guide - SPSNashville 2014
SharePoint & jQuery Guide - SPSNashville 2014SharePoint & jQuery Guide - SPSNashville 2014
SharePoint & jQuery Guide - SPSNashville 2014
 
jQuery: Tips, tricks and hints for better development and Performance
jQuery: Tips, tricks and hints for better development and PerformancejQuery: Tips, tricks and hints for better development and Performance
jQuery: Tips, tricks and hints for better development and Performance
 
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)
 
Prototype & jQuery
Prototype & jQueryPrototype & jQuery
Prototype & jQuery
 
Jquery tutorial
Jquery tutorialJquery tutorial
Jquery tutorial
 
BITM3730 10-4.pptx
BITM3730 10-4.pptxBITM3730 10-4.pptx
BITM3730 10-4.pptx
 

More from tutorialsruby

&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />tutorialsruby
 
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>TopStyle Help &amp; &lt;b>Tutorial&lt;/b>
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>tutorialsruby
 
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>tutorialsruby
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />tutorialsruby
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />tutorialsruby
 
Standardization and Knowledge Transfer – INS0
Standardization and Knowledge Transfer – INS0Standardization and Knowledge Transfer – INS0
Standardization and Knowledge Transfer – INS0tutorialsruby
 
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa0602690047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269tutorialsruby
 
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa0602690047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269tutorialsruby
 
BloggingWithStyle_2008
BloggingWithStyle_2008BloggingWithStyle_2008
BloggingWithStyle_2008tutorialsruby
 
BloggingWithStyle_2008
BloggingWithStyle_2008BloggingWithStyle_2008
BloggingWithStyle_2008tutorialsruby
 
cascadingstylesheets
cascadingstylesheetscascadingstylesheets
cascadingstylesheetstutorialsruby
 
cascadingstylesheets
cascadingstylesheetscascadingstylesheets
cascadingstylesheetstutorialsruby
 

More from tutorialsruby (20)

&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />
 
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>TopStyle Help &amp; &lt;b>Tutorial&lt;/b>
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>
 
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />
 
Standardization and Knowledge Transfer – INS0
Standardization and Knowledge Transfer – INS0Standardization and Knowledge Transfer – INS0
Standardization and Knowledge Transfer – INS0
 
xhtml_basics
xhtml_basicsxhtml_basics
xhtml_basics
 
xhtml_basics
xhtml_basicsxhtml_basics
xhtml_basics
 
xhtml-documentation
xhtml-documentationxhtml-documentation
xhtml-documentation
 
xhtml-documentation
xhtml-documentationxhtml-documentation
xhtml-documentation
 
CSS
CSSCSS
CSS
 
CSS
CSSCSS
CSS
 
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa0602690047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
 
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa0602690047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
 
HowTo_CSS
HowTo_CSSHowTo_CSS
HowTo_CSS
 
HowTo_CSS
HowTo_CSSHowTo_CSS
HowTo_CSS
 
BloggingWithStyle_2008
BloggingWithStyle_2008BloggingWithStyle_2008
BloggingWithStyle_2008
 
BloggingWithStyle_2008
BloggingWithStyle_2008BloggingWithStyle_2008
BloggingWithStyle_2008
 
cascadingstylesheets
cascadingstylesheetscascadingstylesheets
cascadingstylesheets
 
cascadingstylesheets
cascadingstylesheetscascadingstylesheets
cascadingstylesheets
 

Recently uploaded

Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
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
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
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
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
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
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 

Recently uploaded (20)

Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
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
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
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...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
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
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 

jquery

  • 2. What is JavaScript? • An interpreted programming language with object oriented capabilities. • Not Java! – Originally called LiveScript, changed to JavaScript as a marketing ploy by Sun and Netscape. Can also be referred to as ECMAScript. • Not simple! – Although it is loosely typed and can be used by web developers in a “cookbook” fashion (think image rollovers), JavaScript is a fully featured programming language with many advanced features.
  • 3. Client Side JavaScript • When JavaScript is embedded in a web browser, it is referred to as Client Side JavaScript. • Contains an extended set of functionality to interface with the web browser DOM (Document Object Model). • Objects, such as window and document, and functions, like event detection and handling, are included in Client Side JavaScript.
  • 4. What is jQuery? • A framework for Client Side JavaScript. • Frameworks provide useful alternatives for common programming tasks, creating functionality which may not be available or cumbersome to use within a language. • An open source project, maintained by a group of developers, with a very active support base and thorough, well written documentation.
  • 5. What jQuery is not… • A substitute for knowing JavaScript – jQuery is extraordinarily useful, but you should still know how JavaScript works and how to use it correctly. This means more than Googling a tutorial and calling yourself an expert. • A solve all – There is still plenty of functionality built into JavaScript that should be utilized! Don’t turn every project into a quest to ‘jQuery-ize’ the problem, use jQuery where it makes sense. Create solutions in environments where they belong.
  • 6. What is available with jQuery? • Cross browser • JavaScript animation support and detection • Hundreds of plugins • AJAX functions for pre-built user • CSS functions interfaces, advanced animations, form • DOM manipulation validation, etc • DOM transversal • Expandable • Attribute manipulation functionality using • Event detection and custom plugins handling • Small foot print
  • 7. jQuery Syntax $.func(…); or $(selector).func1(…).func2(…).funcN(…); $ jQuery Object, can be used instead of jQuery selector Selector syntax, many different selectors allowed func Chainable, most functions return a jQuery object (…) Function parameters
  • 8. The jQuery/$ Object • Represented by both $ and jQuery – To use jQuery only, use jQuery.noConflict(), for other frameworks that use $ • By default, represents the jQuery object. When combined with a selector, can represent multiple DOM Elements, see next slide. • Used with all jQuery functions.
  • 9. jQuery Selectors • $( html ) • $( expr, context ) Create DOM elements on-the- This function accepts a string fly from the provided String of containing a CSS or basic raw HTML. XPath selector which is then used to match a set of elements. Default context is • $( elems ) document. Used most often for Wrap jQuery functionality DOM transversal. around single or multiple DOM Elements. • Selectors will return a jQuery object, which can contain one or more elements, or contain • $( fn ) no elements at all. A shorthand for $ (document).ready(), allowing you to bind a function to be executed when the DOM document has finished loading.
  • 10. jQuery Selector Examples • $( html ) – $(‘<p><a href=“index.html”>Click here!</a></p>’) • $ ( elems ) – $(document), $(window), $(this) – $(document.getElementsByTagName(“p”)) • $ ( fn ) – $(function() { alert(“Hello, World!”) }); • $ ( expr, context ) – $(“p”), $(“form”), $(“input”) – $(“p#content”), $(“#content”), $(“.brandnew”), $(“p span.brandnew:first-child, #content”) – $(“p/span”), $(“p/span[@class=brandnew]”), $(p/span:first), $(p:first/span:even) – $(“input:checkbox[@checked]”), $(“div:visible p[a]”)
  • 11. jQuery Functions • Attached to the jQuery object or chained off of a selector statement. • Most functions return the jQuery object they were originally passed, so you can perform many actions in a single line. • The same function can perform an entirely different action based on the number and type of parameters.
  • 12. jQuery Usage Example $(“li:odd”).prepend(‘<span>Changed</span>’).css({background:“red”}); <ul> <ul> <ul> <li> <li> <li style=“background:red;”> First item <span>Changed</span> <span>Changed</span> </li> First item First item <li> </li> </li> Second item <li> <li> </li> Second item Second item <li> </li> </li> Third item <li> <li style=“background:red;”> </li> <span>Changed</span> <span>Changed</span> </ul> Third item Third item </li> </li> </ul> </ul>
  • 13. jQuery Usage Example $(“div:hidden”).find(“.foo”).empty().text(“Changed”).end().show(); <div> <div> <div> <span class=“foo”> <span class=“foo”> <span class=“foo”> Some text Some text Some text </span> </span> </span> </div> </div> </div> <div style=“display:none”> <div style=“display:none”> <div style=“display:none”> <span> <span> <span> More text More text More text </span> </span> </span> <span class=“foo”> <span class=“foo”> <span class=“foo”> Goodbye cruel world. Goodbye cruel world. </span> </span> </span> </div> </div> </div> <div> <div> <div> <span class=“foo”> <span class=“foo”> <span class=“foo”> Some text Some text Some text </span> </span> </span> </div> </div> </div> <div style=“display:none”> <div style=“display:none”> <div style=“display:block”> <span> <span> <span> More text More text More text </span> </span> </span> <span class=“foo”> <span class=“foo”> <span class=“foo”> Changed Changed Changed </span> </span> </span> </div> </div> </div>
  • 14. jQuery Advanced Example $(“span.none”).click( <div> function(){ <span class=“all”>Select All</span> $(this).siblings(“:checkbox”).removeAttr(“checked”); } <span class=“none”>Select None</span> ); <input name=“chk1” type=“checkbox”/> <input name=“chk2” type=“checkbox”/> $(“span.all”).click( <input name=“chk3” type=“checkbox”/> function(){ $(this).siblings(“:checkbox”).attr(“checked”,“checked”); </div> } <div> ); <span class=“all”>Select All</span> <span class=“none”>Select None</span> or <input name=“chk4” type=“checkbox”/> <input name=“chk5” type=“checkbox”/> <input name=“chk6” type=“checkbox”/> $(“span”).click( </div> function(){ if($(this).text()==“Select All”)) $(this).siblings(“:checkbox”).attr(“checked”,“checked”); else if ($(this).attr(“class”)==“none”) $(this).siblings(“:checkbox”).removeAttr(“checked”); } );
  • 15. jQuery & AJAX • jQuery has a series of functions which provide a common interface for AJAX, no matter what browser you are using. • Most of the upper level AJAX functions have a common layout: – $.func(url[,params][,callback]), [ ] optional • url: string representing server target • params: names and values to send to server • callback: function executed on successful communication.
  • 16. jQuery AJAX Functions • $.func(url[,params][,callback]) • $.ajax, $.ajaxSetup – $.get – async – $.getJSON – beforeSend – complete – $.getIfModified – contentType – $.getScript – data – $.post – dataType – error • $(selector), inject HTML – global – load – ifModified – processData – loadIfModified – success – timeout • $(selector), ajaxSetup alts – type – ajaxComplete – url – ajaxError – ajaxSend – ajaxStart – ajaxStop – ajaxSuccess
  • 17. jQuery AJAX Example <html> <?php $output = ‘’; <head> <title>AJAX Demo</title> switch($_REQUEST[‘in’]) { case ‘hello’: <script type=“text/javascript” src=“jquery.js”> $output = ‘Hello back.’; </script> break; case ‘foo’: <script type=“text/javascript”> $output = ‘Foo you, too.’; var cnt = 0; break; case ‘bar’: $(function(){ $output = ‘Where Andy Capp can be found.’; $.ajaxSettings({ break; case ‘foobar’: error:function(){alert(“Communication error!”);} $output = ‘This is German, right?’; }); break; default: $(“:button”).click(function(){ $output = ‘Unrecognized string.’; var input = {in:$(“:textbox”).val(),count:cnt}; } $.getJSON(“ajax.php”,input,function(json){ $count = $_REQUEST[‘count’]+1; cnt = json.cnt; echo json_encode( $(“.cnt”).text(cnt) array( $(“.msg”).text(json.out); ‘out’ => $output, ‘cnt’ => $count }); ) }); ); }); exit; </script> ?> </head> <body> <p>
  • 18. jQuery Resources • Project website – http://www.jquery.com • Learning Center – http://docs.jquery.com/Tutorials – http://www.learningjquery.com/ – http://15daysofjquery.com/ • Support – http://docs.jquery.com/Discussion – http://www.nabble.com/JQuery-f15494.html mailing list archive – irc.freenode.net irc room: #jquery • Documentation – http://docs.jquery.com/Main_Page – http://www.visualjquery.com – http://jquery.bassistance.de/api-browser/ • jQuery Success Stories – http://docs.jquery.com/Sites_Using_jQuery