Created
April 8, 2014 08:52
-
-
Save troelskn/10102663 to your computer and use it in GitHub Desktop.
jquery - find closest data attribute.
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
var listId = $(this).parents().filter(function() { return $(this).data("list-id"); }).eq(0).data("list-id"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you.
For those looking for a way to get the closest parent link with attribute, use
Without
.data("list-id");
at the end.