Quantcast
Channel: professional website design » Objective-c
Viewing all articles
Browse latest Browse all 18

The Mystery Of The jQuery Object: A Basic Introduction

$
0
0
Have you ever come across a bit of JavaScript like $(".cta").click(function(){}) and thought, “What the $('#x') is that” If it looks like gibberish to you, then please read on. If you think that snippet of code couldn’t possibly be real, then please browse some jQuery examples . They are full of such constructions. This article covers the key concepts that underly such intimidating fragments of code, but we’ll start with a longer example, based on a simple example of animating a square. You are probably not required to do this every day, but it makes for a concise and tidy demonstration: $(document).ready(function(){ $("button").click(function(){ $("div").animate({height:"toggle"}).append("hi"); }); }); We’ll go through every word and feature of the code above, along with a detailed look at JavaScript functions, the jQuery object and event-driven programming . By the end, you will hopefully no longer feel anxious in the face of such inscrutable code. What Is $ ?

Viewing all articles
Browse latest Browse all 18

Trending Articles