Try jQuery (Level 1) at Code School

Learn the basic building blocks of jQuery 2.0 and enjoy new video tutorials for beginners with related programming challenges. “Learn by Doing”, at Code School. Play the entire course: Try jQuery at Code School


Usage styles

jQuery has two usage styles:

  • Via the $ function, which is a factory method for the jQuery object. These functions, often called commands, are chainable as they all return jQuery objects.
  • Via $.-prefixed functions. These are utility functions, which do not act upon the jQuery object directly.

Access to and manipulation of multiple DOM nodes in jQuery typically begins with calling the $ function with a CSS selector string. This returns a jQuery object referencing all the matching elements in the HTML page. $("div.test"), for example, returns a jQuery object with all the div elements of class test. This node set can be manipulated by calling methods on the returned jQuery object or on the nodes themselves.

No-Conflict Mode

jQuery also includes .noConflict() mode, which relinquishes control of $. This can be helpful if jQuery is used with other libraries that also use $ as an identifier. In no-conflict mode, developers can use jQuery as a replacement for $ without losing functionality.

Typical start-point

The typical jQuery usage is to put initialization code and event handling functions in .ready(). This is triggered when the browser has constructed the DOM and sends a load event.

<script type="text/javascript">
        // jQuery code, event handling callbacks here

Callback functions for event handling are also included inside .ready() as anonymous functions but called when the event for the callback is triggered. For example, the following jQuery code adds an event handler for a mouse click on an img image element.

        $('img').click ( function() { 
              // handle the click event on any img element in the page

The following syntaxes are equivalent:

  • $(document).ready(handler)
  • $(handler)


Each jQuery command returns a jQuery object, so commands can be chained:


This line finds the union of all div tags with class attribute test and all p tags with class attribute quote, adds the class attribute blue to each matched element, and then increases their height with an animation. The $ and add functions affect the matched set, while the addClass and slideDown affect the referenced nodes.

Creating new DOM elements

Besides accessing DOM nodes through jQuery object hierarchy, it is also possible to create new DOM elements if a string passed as the argument to $() looks like HTML. For example, this line finds an HTML select element with ID carmakes, and adds an option element with value “VAG” and text “Volkswagen”:

$('select#carmakes').append($('<option />').attr({value:"VAG"}).append("Volkswagen"));

See more resources:

Your first jQuery-enabled page
Up and Running with jQuery UI

Build My Site

CSS: Animation Basics

This course presents a short series of CSS animation techniques, such as looping, playing, and pausing, and puts them together in a small project: an animated infographic. Author Val Head also addresses using CSS preprocessors, adding transitions, handling vendor prefixes, and understanding the best uses for CSS animations. Plus, discover how to measure the performance and current level of browser support for CSS animations and how we can expect the technology to change. See more: CSS Video Courses and Tutorials from

Topics include:

  • Understanding delay and fill-mode
  • Dictating an animation’s direction
  • Using easing
  • Adding keyframes
  • Looping an animation
  • Chaining multiple animations on one element
  • Setting up the HTML structure
  • Adding interactivity with JavaScript

CSS Animations

CSS Animations affect computed property values. During the execution of an animation, the computed value for a property is controlled by the animation. This overrides the value specified in the normal styling system. Animations override all normal rules, but are overriden by !important rules.

If at one point in time there are multiple animations specifying behavior for the same property, the animation whose name occurs last in the value of ‘animation-name’ will override the other animations at that point.

An animation does not affect the computed value before the application of the animation, before the animation delay has expired, and after the end of the animation.


Computation of animated property values

The diagram above shows how property values are computed. The intrinsic style is shown at the top of the diagram. The computed value is derived from intrinsic style at the times when an animation is not running and also when an animation is delayed (see below for specification of animation delay). During an animation, the computed style is derived from the animated value.

An animation applies to an element if the element has a value for ‘animation-name’ that references a valid keyframes rule. Once an animation has started it continues until it ends or the ‘animation-name’ is removed. The values used for the keyframes and animation properties are snapshotted at the time the animation starts. Changing them during the execution of the animation has no effect. Note also that changing the value of ‘animation-name’ does not necessarily restart an animation (e.g., if a list of animations are applied and one is removed from the list, only that animation will stop; The other animations will continue). In order to restart an animation, it must be removed then reapplied.

The end of the animation is defined by the combination of the ‘animation-duration’, ‘animation-iteration-count’ and ‘animation-fill-mode’ properties.

Some Examples of CSS Transitions and Animations

I have seen some remarkable work done purely with CSS, no additional graphics. Developers and designers are doing some amazing things with CSS. CSS is a powerful language. Below, I have compiled some of the most intriguing and inspirational projects using only CSS. They are all really good but the first one is truly my favorite!

The Simpsons in Pure CSS by Chris Pattle

See the Pen azBbEL by Darlene Tate (@D-Pens) on CodePen.

CSS Animated Gallery With Persistent Images By Dudley Storey

See the Pen CSS Animated Gallery With Persistent Images by Dudley Storey (@dudleystorey) on CodePen.

3D Solar System by Julian Garnier

See the Pen CSS 3D Solar System by Julian Garnier (@juliangarnier) on CodePen.

CSS Animate By Kevin Bourke (changing animation and colour using keyframes)

See the Pen CSS Animations by Kevin Bourke (@bourkekev) on CodePen.

See more resources:

The guide to CSS animations for the web
CSS 3D Folding Animation
CSS Animation Tricks: State Jumping, Negative Delays, Animating Origin, and More

Build My Site

JavaScript Templating | What is Templating?

JavaScript templates take simple web apps to the next level, keeping your application logic separate from your presentation and your HTML and JS files clean. This course provides a look at popular JavaScript template solutions for modern web apps that consume and display data. Joe Marini reviews four popular templating libraries: JQuery Template, a simple solution that plugs straight into jQuery; Handlebars and Mustache, which provide greater flexibility; and Dust, the templating engine for more complex scenarios. Watch more at: JavaScript Templating.

Topics include:

  • What is templating?
  • Defining templates in jQuery Template
  • Using simple Mustache templates with sections and conditions
  • Adding conditionals and loops to Handlebars templates
  • Working with Dust templates

JavaScript Templating

JavaScript templating refers to the client side data binding method implemented with the JavaScript language. This approach became popular thanks to JavaScript’s increased use, its increase in client processing capabilities, and the trend to outsource calculus to the client’s web browser. Popular JavaScript templating libraries are AngularJS, Backbone.js, Ember.js, Handlebars.js, and Mustache.js. A frequent practice is to use double curly brackets (i.e. {{key}}) to call values of the given key from data files, often JSON objects.

Template Engine

The template engine is responsible for:

  • connecting to the data model;
  • processing the code specified in the source templates; and
  • directing the output to a specific pipeline, text file, or stream.

Additionally some template engines allow additional configuration options. A template engine is ordinarily included as a part of a web template system or application framework, and may be used also as preprocessor or filter.


A diagram illustrating all of the basic elements and processing flow of a template engine.

A template engine is a specific kind of template processing module that exhibits all of the major features of a modern programming language. The term template engine evolved as a generalized description of programming languages whose primary or exclusive purpose was to process templates and data to output text. The use of this term is most notably applied to web development using a web template system, and it is also applied to other contexts as well.

Benefits of using template engines

  • encourages organization of source code into operationally-distinct layers (see e.g., MVC)
  • enhances productivity by reducing unnecessary reproduction of effort
  • enhances teamwork by allowing separation of work based on skill-set (e.g., artistic vs. technical)

Templating becomes useful when the information distributed may change, is too large to be maintained in various HTML pages by available human resources and not large enough to require heavier server-side templating.

See more resources:

JavaScript Templates, Mozilla Developer Network
The client-side templating throwdown: mustache, handlebars, dust.js, and more
Best Practices When Working With JavaScript Templates

Build My Site

Introduction to the “Internet of Things”

In this course, Michael Lehman shows how to program these “things” and build companion apps to monitor and record their activities from iOS devices. Learn what’s inside a thing, how location-awareness technologies such as iBeacon connect the IoT in public spaces, and how you can create your own things with hardware like the Arduino and Raspberry Pi kits. Michael also shows how to use IFTTT services to control things on iOS, and muses on the future of IoT. Along the way, you’ll gain experience with real-world IOT-driven projects, like a mini weather station and a home lighting system. Watch more at: Programming the Internet of Things with iOS.

Topics include:

  • Exploring the IoT universe
  • Understanding sensors and effectors
  • Connecting inputs and outputs
  • Connecting to devices via Wi-Fi or Bluetooth
  • Using Apple iBeacon
  • Creating your own things with programmable hardware
  • Using IFTTT to program things
  • Exploring trends in IoT

Internet of Things

What are the “things”?

The “things” are programmable devices such as: home appliances, measuring environmental conditions (a thermostat turning the heat on at a specified temperature), automobiles, home security, headphones, audio, our phones, web applications, and almost anything you can imagine! Yes, you can program your own “thing” to do simple tasks for you.

internet of things

IFTTT (abbreviation of “If This Then That“) pronounced like “gift” without the “g”, is a web-based service which allows other services (e.g., Gmail, Google Reader, Instagram, Craigslist) to be programmed by means of simple conditional statements (called “recipes”).

IFTTT employs the following concepts:

  • Channel is called “basic building blocks of IFTTT”, it mainly describes a series of data from a certain web service such as Youtube or ebay. Beside, it can also describe some certain actions controlled with application program interface (API) like SMS. Sometimes, it means information supply in terms of weather or stocks. There are particular triggers and actions in each channel. Right now, 140 channels are available in total.
  • Recipe just means ” If this then that”. A recipe combines an action and a trigger in a specific channel. Users may create their own recipes. If any picture liked by you in Instagram, for example, the photo will be sent to your Dropbox file and saved in it.
  • Trigger is the “this” part of a recipe. It describes an assumptive event which could result in an action. What triggers you can choose always depend on which channel you select, for example, picking a RSS feed, you can select a new one that relates to reserved words.
  • Action is the “that” part of a recipe. It describes a consequence led by a specific trigger. Some examples are “save the graph in my file” or “the alarm rings”.
  • Ingredients are basic elements from a trigger. As the IFTTT official website gave an example: “The Ingredients of an Email Trigger could be: subject, body, attachment, received date, and the sender’s address.”

Usage examples

  • IFTTT can automatically automate web-application tasks, such as posting the same content on several social media.
  • IFTTT can be used to connect web applications and provide new functionality.

See more resources:

iOS 8 SDK New Features
Building a Note-Taking App for iOS 8
iOS App Development with Swift Essential Training
Disruptive IoT Innovation: Adding Value to Connected Devices
The Internet of Things – the way to sense, compute & connect

Build My Site

Elements of an Android App

Creating an app for Android doesn’t require a full-blown integrated development environment. There are several simple, easy-to-learn and easy-to-use tools that make programming Android apps a breeze. Michael Lehman introduces MIT App Inventor 2, Basic4android, and a few other entry-level development environments to build your own app. He’ll show how to test apps on an Android emulator or directly on your phone or tablet, and demonstrate tools for building hybrid apps that run on Android, Windows Phone, and iOS devices, as well as straight on the web. Start building your first app with these simple tools today. See more at: Simple Android Development Tools.

Topics include:

  • Understanding the elements of an Android app, such as controls, sensors, effectors, and storage
  • Exploring MIT App Inventor 2
  • Getting started with Basic4android
  • Building simple apps
  • Testing apps on Android emulators and devices
  • Sharing apps
  • Creating hybrid apps with Appy Pie, Make Me Droid, and AppMakr

App Inventor for Android


Google App Inventor

App Inventor for Android is an open-source web application originally provided by Google, and now maintained by the Massachusetts Institute of Technology (MIT).

It allows newcomers to computer programming to create software applications for the Android operating system (OS). It uses a graphical interface, very similar to Scratch and the StarLogo TNG user interface, which allows users to drag-and-drop visual objects to create an application that can run on Android devices. In creating App Inventor, Google drew upon significant prior research in educational computing, as well as work done within Google on online development environments.

App Inventor and the projects on which it is based are informed by constructionist learning theories, which emphasizes that programming can be a vehicle for engaging powerful ideas through active learning. As such, it is part of an ongoing movement in computers and education that began with the work of Seymour Papert and the MIT Logo Group in the 1960s and has also manifested itself with Mitchel Resnick’s work on Lego Mindstorms and StarLogo.

App Inventor includes:

  • A designer, in which a program’s components are specified. This includes visible components, such as buttons and images, which are placed on a simulated screen, and non-visible components, such as sensors and web connections.
  • A blocks editor, in which the program’s logic is created.
  • A compiler based on the Kawa language framework and Kawa’s dialect of the Scheme programming language, developed by Per Bothner and distributed as part of the GNU operating system by the Free Software Foundation.
  • An app for real-time debugging on a connected Android device.

On December 6, 2013 (the start of the Hour of Code), MIT released App Inventor 2, renaming the original version “App Inventor Classic” Major differences are:

  • The blocks editor in the original version ran in a separate Java process, using the Open Blocks Java library for creating visual blocks programming languages.
    Open Blocks is distributed by the Massachusetts Institute of Technology’s Scheller Teacher Education Program (STEP) and is derived from master’s thesis research by Ricarose Roque. Professor Eric Klopfer and Daniel Wendel of the Scheller Program supported the distribution of Open Blocks under an MIT License. Open Blocks visual programming is closely related to StarLogo TNG, a project of STEP, and Scratch, a project of MIT Media Laboratory’s Lifelong Kindergarten Group. App Inventor 2 replaced Open Blocks with Blockly, a blocks editor that runs within the browser.
  • The | MIT AI2 Companion app enables real-time debugging on connected devices via Wi-Fi, not just USB.

As of May 2014, there were 87 thousand weekly active users of the service and 1.9 million registered users in 195 countries for a total of 4.7 million apps built.

Build My Site

MIT Opencourseware – OCW

MIT OpenCourseWare makes the materials used in the teaching of almost all of MIT’s subjects available on the Web, free of charge. With more than 2,200 courses available, OCW is delivering on the promise of open sharing of knowledge.

More Resources:

Women in STEM
Up and Running with C
A Gentle Introduction to Programming Using Python
New Course: Object-Orientated Python

Build My Site