Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 1987yama3/8e363e29ef35b691c931f0d63b97b6e5 to your computer and use it in GitHub Desktop.
Save 1987yama3/8e363e29ef35b691c931f0d63b97b6e5 to your computer and use it in GitHub Desktop.
属性を持つ要素まで遡る
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