Last active
April 12, 2017 18:46
-
-
Save mfdj/e5a42f8dc73334b6dcff7d392d5c992b to your computer and use it in GitHub Desktop.
console snippet to find all the forms on page
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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