Skip to content

Instantly share code, notes, and snippets.

@kumekay
Created November 17, 2013 12:13
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 kumekay/7512624 to your computer and use it in GitHub Desktop.
Save kumekay/7512624 to your computer and use it in GitHub Desktop.
Consone forms
[].forEach.call(document.querySelectorAll('form'), function (input) {
var table = [];
console.group('HTMLForm "' + input.name + '": ' + input.action);
console.log('Element: ', input, '\nName: ' +
input.name + '\nMethod: ' + input.method.toUpperCase() +
'\nAction: ' + input.action || 'null');
['input', 'textarea', 'select'].forEach(function (control) {
[].forEach.call(input.querySelectorAll(control), function (node) {
table.push({
'Element': node,
'Type': node.type,
'Name': node.name,
'Value': node.value,
'Pretty Value': (isNaN(node.value) || node.value === '' ?
node.value : parseFloat(node.value))
});
});
});
console.table(table);
console.groupEnd();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment