8000 GitHub - dominicbarnes/form-controls: A helper for retrieving all valid form controls for a given root (usually a form or fieldset) · GitHub
[go: up one dir, main page]

Skip to content

About

A helper for retrieving all valid form controls for a given root (usually a form or fieldset)

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

9 Commits

Folders and files

Repository files navigation

form-controls

npm version npm dependencies npm dev dependencies build status

A helper for retrieving all of the controls for a given root element.

Usage

<form id="my-form">
    <input type="hidden" name="id" value="123456">
    <input type="text" name="username" value="dominicbarnes">
    <input type="url" name="website" value="http://dbarnes.info/">
</form>
var controls = require('form-controls');
var el = document.querySelector('#my-form');

controls(el);
// => [
//     <input type="hidden" name="id" value="123456">,
//     <input type="text" name="username" value="dominicbarnes">,
//     <input type="url" name="website" value="http://dbarnes.info/">
// ]

API

controls(root)

Returns an Array of HTMLElement that represent the listed controls for the root element.

It is recommended that you use either a <form> or <fieldset> as the root, as there is already a DOM API for this operation. However, other arbitrary elements are supported, mostly because I needed a "brute-force" fallback for when IE doesn't work anyways.

About

A helper for retrieving all valid form controls for a given root (usually a form or fieldset)

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages

0