Skip to content

Instantly share code, notes, and snippets.

@shrinkray
Created November 8, 2019 15:21
Show Gist options
  • Select an option

  • Save shrinkray/53a88830ae064c0071deeac76fefd609 to your computer and use it in GitHub Desktop.

Select an option

Save shrinkray/53a88830ae064c0071deeac76fefd609 to your computer and use it in GitHub Desktop.
A quick, in-browser console trick for getting content from an HTML page.
/**
* In this example, I wanted to create a list of names of Custom Fields.
*/
const titles = document.querySelectorAll('.row-title');
for ( const title of titles ) {
// Because it is returned in the browser, we're getting the VM numbering thing in console log
// Experiment with a way to drop these in an array instead.
console.log( title.textContent );
}
// Without Destructuring, Returns
VM5020:3 Assessment
VM5020:3 Assets
VM5020:3 Blog
VM5020:3 Career
VM5020:3 Case Study
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment