Skip to content

Instantly share code, notes, and snippets.

@ravewebdev
Last active July 9, 2020 18:29
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 ravewebdev/bee8ae51e19fffe13da85107d7267e87 to your computer and use it in GitHub Desktop.
Save ravewebdev/bee8ae51e19fffe13da85107d7267e87 to your computer and use it in GitHub Desktop.
2.2.1. Target block instances and retrieve attributes
const trackerClass = 'wp-block-rave-initiative-tracker';
const trackers = document.querySelectorAll( `.${trackerClass}` );
trackers.forEach( ( tracker ) => {
const attributes = {
block_id: tracker.dataset.id,
post_id: parseInt( tracker.dataset.post_id, 10 ),
};
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment