Introduction to jQuery through CodeSchool

http://try.jquery.com/levels/1/challenges/1

From Ruby to JavaScript into jQuery

Learning jQuery when you’re new to JavaScript can sometimes make you feel like you’re reading/writing alien code. It’s not quite as foreign as some lower-level languages, but the clutter of $(‘#this’).on(‘click’, ‘that’, function {

});

Overwhelming, at first glance.

But after slowly working through all five chapters of the CodeSchool course, I can confidently say that I could write some basic javascript animations for “on clicks”, “…mouseenters”, “…mouseleaves”, etc that might look kind of nice? Being least familiar with HTML and CSS, I have definitely now found a deep appreciation for simplicity — clean and simple CSS seems to allow for the best jQuery. But let’s talk a bit about the other aspects of using jQuery.

It pretty much uses basic concepts of JavaScript, with a few shorthand notations for grabbing things. At this point, the concepts of numbers, strings, and variables is nothing new — familiarity with writing JavaScript functions (and sometimes objects) will also come in handy. The shorthands, however, are not so recognizable.

$(‘.something’)

The $ is a shorthand for using the jquery() function. Inside, we need a string — here, the string begins with a . which denotes that we want a class from our CSS. Additionally, we need to remember # denotes an id in CSS. After that, it’s just getting used to all the extra (), {}, and ; — Javascript, woo!