jQuery

  • jQuery's motto is write less, do more
  • jQuery was originally written by John Rezig
  • It is now maintained by a strong community
  • There is even a yearly jQuery conference in Toronto
  • http://jquery.com

Define what a library vs framework is

List primary components of jQuery

  • DOM traversal
  • Event Handling
  • Ajax interactions
  • Event Handling

How to include jQuery into an app

Select existing DOM nodes

Example ... in jQuery
Elements $("element")`, `$("#id")` or `$(".class")
Descendants $("#id descendant")
Children $(".class > child")
Multiple $("#id1, #id2, #id3")
Pseudo-selectors $("li :first")

Build and append custom DOM nodes

  • .append()
  • .appendTo()
  • .text()
  • .prepend()
  • .prependTo()
  • .html()

Trigger and listen to events

$(selector).click(function() {
  // your code
});

Using jQuery in your html head element

  • In your index.html file, add: <script type='text/javascript' src='scripts/jquery.js'></script>

Resources & Further Reading

results matching ""

    No results matching ""