Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save ryota-yamada-jp/8e363e29ef35b691c931f0d63b97b6e5 to your computer and use it in GitHub Desktop.

Select an option

Save ryota-yamada-jp/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