$('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