Skip to content
This repository has been archived by the owner on May 27, 2024. It is now read-only.

Commit

Permalink
Fixed small issue with target property.
Browse files Browse the repository at this point in the history
  • Loading branch information
chrishumboldt committed Jan 16, 2018
1 parent 0e38f45 commit 3f75e93
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,22 +51,22 @@ Rocket.form();
</script>
```

## Initialization
## Initialisation
Each initialization will bind to new form targets but will overlook existing ones. However existing form targets will have the state updated.

#### Options
See the different options you have available on initialization.
See the different options you have available on initialisation.

Name | Default | Options | Description
---- | ---- | ---- | ----
`targets` | `.mod-form` | | Set the HTML target.
`target` | `.mod-form` | | Set the HTML target.
`colour` | `blue` | `grey` `black` `white` `aqua` `blue` `green` `orange` `pink` `purple` `red` `grey-blue` | Set the colour of the form elements.
`label` | `normal` | `normal` `shift` | Set an animation on the form label.
`style` | `line` | `flat` `line` `raised` | Set the style of the form elements.

```javascript
Rocket.form({
targets: '.form-element',
target: '.form-element',
colour: 'red',
label: 'shift',
style: 'raised'
Expand Down
6 changes: 3 additions & 3 deletions build/js/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

// Set the defaults
Rocket.defaults.form = {
targets: '.mod-form',
target: '.mod-form',
colour: 'blue',
label: 'normal',
size: 'normal',
Expand All @@ -13,7 +13,7 @@ Rocket.defaults.form = {

// Module
Rocket.form = ({
targets = Rocket.defaults.form.targets,
target = Rocket.defaults.form.target,
colour = Rocket.defaults.form.colour,
label = Rocket.defaults.form.label,
size = Rocket.defaults.form.size,
Expand Down Expand Up @@ -163,7 +163,7 @@ Rocket.form = ({
};

function init() {
const formElms = Rocket.dom.select(targets);
const formElms = Rocket.dom.select(target);

updateFormClasses();
if (formElms.length > 0) { formElms.map((item) => applyForm(item)) };
Expand Down
6 changes: 3 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ <h4>HTML and Javascript Call</h4>
&lt;/div&gt;

&lt;script&gt;
// Default targets property is ".mod-form".
// Default target property is ".mod-form".
Rocket.form({
colour: 'red',
style: 'raised'
});

// With Shifting Label
Rocket.form({
targets: '.mod-form-alt',
target: '.mod-form-alt',
colour: 'red',
label: 'shift',
style: 'raised'
Expand Down Expand Up @@ -208,7 +208,7 @@ <h4>Detailed Documentation</h4>
<script src="build/js/form.js"></script>
<script>
Rocket.form();
Rocket.form({targets: '.mod-form-alt', label: 'shift'});
Rocket.form({target: '.mod-form-alt', label: 'shift'});
</script>

</body>
Expand Down
2 changes: 1 addition & 1 deletion js/form.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rocket-form",
"version": "3.2.0",
"version": "3.2.1",
"description": "A simple form module.",
"main": "js/form.min.js",
"repository": {
Expand Down

0 comments on commit 3f75e93

Please sign in to comment.