Skip to content

Commit

Permalink
added name method
Browse files Browse the repository at this point in the history
  • Loading branch information
ianstormtaylor committed Jul 31, 2013
1 parent 635d16b commit 2cc2d71
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 deletions.
4 changes: 4 additions & 0 deletions History.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
0.0.2 - July 31, 2013
---------------------
* added `name` method

0.0.1 - July 10, 2013
---------------------
:sparkles:
9 changes: 6 additions & 3 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,16 @@ toggle.value(); // false
### Toggle(value, el)
Create a new toggle with an optional starting `value` and optional `el` to use instead of creating one.

### .el
### #el
The toggle's DOM element.

### .value(val)
### #value(val)
Get or set the value of the toggle.

### .toggle()
### #name(name)
Set the toggle's internal checkbox's name, so forms can be submitted properly.

### #toggle()
Toggle the value of the toggle.

### .label(on, off)
Expand Down
2 changes: 1 addition & 1 deletion component.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "toggle",
"repo": "segmentio/toggle",
"license": "MIT",
"version": "0.0.1",
"version": "0.0.2",
"description": "A toggle UI element.",
"keywords": ["toggle", "ui", "checkbox"],
"dependencies": {
Expand Down
13 changes: 13 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,19 @@ Toggle.prototype.value = function (val) {
};


/**
* Set the toggle's name, on the checkbox. That way forms that get submitted
* will get the proper value.
*
* @param {String} name
* @return {Toggle}
*/

Toggle.prototype.name = function (name) {
this.checkbox.name = name;
};


/**
* Toggle the toggle :)
*
Expand Down

0 comments on commit 2cc2d71

Please sign in to comment.