Skip to content

Commit

Permalink
Prefix selector caches with a dollar symbol
Browse files Browse the repository at this point in the history
  • Loading branch information
OCannings committed Mar 18, 2013
1 parent adb7570 commit 9b7afbf
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions jquery-patterns/cache-selector.html
Expand Up @@ -17,15 +17,16 @@


// preferred
var photo;
var $photo;
// prefix the cache with $ to help identify it as a selector cache later
$('.list-item').click(function () {
photo = photo || $('.photo');
photo.hide();
$photo = $photo || $('.photo');
$photo.hide();
});


// References
// http://ejohn.org/blog/learning-from-twitter/
</script>
</body>
</html>
</html>

0 comments on commit 9b7afbf

Please sign in to comment.