// "Pure" JavaScript way.
// document.body.innerHTML = "<h1>jQuery!</h1>"

// jQuery way.

// Applies to the element with id of 'hello'.
$('#hello').text('jQuery!');

// Applies to all h1 elements.
$('h1').click(function(){
  alert('You clicked on an h1 tag!');
  $(this).toggleClass("big");
});

// Changing a css property.
$('#hello').click(function(){
  $('body').css('background-color', 'red');
});

// Changing an html attribute.
$('img').click(function(){
  $(this).attr('src', 'http://bin.sc/Projects/thePRBAT/figures/2011-3-21_23-44_2ACA27.png');
  // Go to a new page after half a second.
  setTimeout(function(){
    document.location.href = "http://rey.sc";
  }, 500);
});

// Playing a video when clicking on '#play'.
$('#play').click(function(){
  var video = $('video').get(0);
  if(video.paused){
    video.play();
  } else {
    video.pause();
  }
});




















