Created
November 15, 2012 11:08
-
-
Save r37r0m0d3l/4078044 to your computer and use it in GitHub Desktop.
javascript get dataset from event
This file contains hidden or 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
// as property | |
event.currentTarget.dataset.id | |
// as array element | |
event.currentTarget.dataset['id'] | |
// jquery method | |
$(event.currentTarget).data('id') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you!!!!
That's the nice thing about vanilla JS, Still working like a charm!