4.0.4 • Published 3 years ago
ct-form v4.0.4
form (upgrade)
In order for this plugin to work in older browsers, includ webcomponents.js plugin https://github.com/webcomponents/webcomponentsjs
How to use it
1. Include js file in footer of the page
<script src="build/ct-form.min.js"></script>2. Using in html
<form is="ct-form" name="example">
<input type="text" name="name"/>
<input type="email" name="email"/>
</form>3. Access
// using global access: form + [name]
// when form name="example"
formExample.method();Methods
toJson()- get data from all children inputstoFormData()- get data from all children inputs, used formData for filesclear()- Clear all children inputsget()- get value from one input by nameadd()- add key to data, not change input
Attributes
is="ct-form"- for using modificator-requireddata-id- must be unique in one page-required