Created
May 31, 2017 03:12
-
-
Save 1987yama3/8e363e29ef35b691c931f0d63b97b6e5 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
function () { | |
var element = {{gtm.element}}; | |
while (!element.hasAttribute('data-no')) { | |
element = element.parentElement; | |
} | |
return element.getAttribute('data-no'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment