Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Caching Selector Results section code example #18

Closed
acusti opened this Issue · 2 comments

2 participants

@acusti

I am guessing that the following code example is not actually supposed to be using PHP style variable naming:

// before
var $quoteLinks = $(".quote a");  // the only DOM query
$quoteLinks.bind("click", doStuff);

// now
$quoteLinks.addClass("quoteLink");

// later
$quoteLinks.fadeIn("slow");

Should the first line (and subsequent references) be: var quoteLinks = $(".quote a"); ?

@tapichu

Some people like adding the $ prefix to variables that hold a jQuery object. It's a valid javascript identifier so I guess it boils down to personal preference.

@acusti

Right on. I didn’t actually know it was a valid javascript identifier. Thanks for letting me know!

@acusti acusti closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.