A helper for working with HTML forms, contains the functionality of:
all wrapped up in a nice package.
<form id="my-form">
<input type="hidden" name="id" value="123456">
<input type="text" name="user.name" value="dominicbarnes">
<input type="url" name="user.website" value="http://dbarnes.info/">
</form>var Form = require("form");
var el = document.querySelector("#my-form");
var form = new Form(el);
form.input("id");
// => <input type="hidden" name="id" value="123456">
form.serialize();
// => { id: "123456", user: { name: "dominicbarnes", website: "http://dbarnes.info" } }
form.value("user.name");
// => "dominicbarnes"
form.value("id", "abc123");
// sets "abc123" as the value for the "id" inputCreates a new wrapper (new keyword not required) for the input el (should be an HTMLFormElement)
Returns the form element(s) with the supplied name.
(see dominicbarnes/form-element)
Gets or sets the value for the input matching name
(see component/value)
NOTE: This method does not currently support checkboxes or radio groups.
Serializes the entire form into a single JS object. (see dominicbarnes/form-serialize)
A CSS class helper via component/classes.