Friday, October 28, 2016

$(document).ready()

For jQuery to load properly we want to make sure that the document which is the html or the DOM file loads fully first.  Incasing your jQuery in $(document).ready() tells jQuery to hold up and wait its turn.

Here's an example:

//wait till the document file has loaded then executes a function (with no parameters)
$(document).ready(function() {
//print out "Hello" to the console.
  console.log("Hello");
//close
})

You can also do the short hand.

//the (document).ready is optional. 
$(function() {
  console.log("Hello");
})

What is jQuery?

jQuery is a javascript library designed with a fast and light approach to programing in javascript.  It was created by  John Resig in 2006 with the motto of "write less, do more".  jQuery simplifies HTML document traversing, event handing, animation, Ajax interactions and more.

  • DOM Manipulation - jQuery makes it easy to traverse HTML elements.  This also makes selecting elements extremely fast and easy.
  • Event Handling - jQuery makes events like "clicking the mouse, hover over an item" easy to do in a quick and intuitive way.
  • Animations - it comes with a number a animations that are commonly used.  
  • Lightweight - jQuery's js file is about 19kb.
  • Ajax -  Helps to develop a responsive site feature rich using Ajax.  "I'll find out what this is later"
Find more information at jQuery.

Mastering jQuery by teaching.

Hello World.

I'm in the process of mastering jQuery...

I currently know very little about jQuery but I know that a lot of web developers use it to make coding in javascript easier.  I hope to find out why it's easier and if in fact it is.   All while providing another online resource for Newb's like me.  Sorry in advanced for all the grammatical errors.