jQuery notes

How to select things and modify them:

$("#css_selector").prop("some_html_attribute", "value")

Examples:

  1. Setting HTML properties
isAuthenticated = ...;
$("btn-logout").prop("disabled", !isAuthenticated);
  1. Setting CSS properties
if (isAuthenticated) {
    $("#content").css('visibility', 'visible')
}

else {
    $("#content").css('visibility', 'hidden')
}

Why build single-page apps over multi-page apps

After stumbling upon the use of jQuery (see: jQuery notes), I became intrigued by the prospect of building single-page apps, in which the DOM is manipulated directly by jQuery/JavaScript.

Some research into why we would want to build single page apps, and why we wouldn't.

Pros

From Ruby Garage

  1. Requires no page reloads
  2. Fast, responsive; only requested content is loaded.

Quoting from Wikipedia:

The goal is faster transitions that make the website feel more like a native app.

Cons

  1. Difficult to do SEO optimization
  2. No browser history; need JS hacks
  3. Easier to hack by cross-site scripting (XSS)