Skip to content

Instantly share code, notes, and snippets.

@mfdj
Last active April 12, 2017 18:46
Show Gist options
  • Save mfdj/e5a42f8dc73334b6dcff7d392d5c992b to your computer and use it in GitHub Desktop.
Save mfdj/e5a42f8dc73334b6dcff7d392d5c992b to your computer and use it in GitHub Desktop.
console snippet to find all the forms on page
toArray = function(itterable) {
return Array.prototype.slice.call(itterable)
}
toArray(document.querySelectorAll('form')).map(function(form) {
let name = form.id
? `#${form.id}`
: (form.classList.length > 0
? '.' + toArray(form.classList).join('.')
: 'form');
let action = form.action ? form.action : 'self';
return `${name} : ${form.method} : ${action}`;
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment