Created
May 24, 2015 12:28
-
-
Save airportyh/cb9830377272a2d0a816 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('a.link').click(function(){ | |
// `this` is an anchor DOM element in this context | |
// but it's not wrapped in a jQuery wrapper and doesn't | |
// have access to any of jQuery's helper methods. | |
var $a = $(this); | |
// once you wrap it in jQuery, it has access to them, | |
// for example to `.attr()`, `.prop()`, `.val()`, etc. | |
console.log('Clicked on', $a.attr('href')); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment