Skip to content

Instantly share code, notes, and snippets.

@twhite96 twhite96/example.js forked from airportyh/example.js
Last active Aug 29, 2015

What would you like to do?
// `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'));

This comment has been minimized.

Copy link
Owner Author

twhite96 commented May 30, 2015

Trying to understand $(this)...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.