Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wbotelhos/nestedy
:arrow_heading_down: Nestedy - A Nested Fields Creator
https://github.com/wbotelhos/nestedy
javascript jquery-nestedy nested nested-attributes nested-fields rails
Last synced: about 1 month ago
JSON representation
:arrow_heading_down: Nestedy - A Nested Fields Creator
- Host: GitHub
- URL: https://github.com/wbotelhos/nestedy
- Owner: wbotelhos
- Created: 2013-09-17T14:12:40.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2015-03-25T03:44:58.000Z (almost 10 years ago)
- Last Synced: 2024-10-15T08:57:37.513Z (3 months ago)
- Topics: javascript, jquery-nestedy, nested, nested-attributes, nested-fields, rails
- Language: JavaScript
- Homepage: http://wbotelhos.com/nestedy
- Size: 265 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: changelog.md
Awesome Lists containing this project
README
# jQuery Nestedy - A nested fields creator - [wbotelhos.com/nestedy](http://wbotelhos.com/nestedy)
jQuery Nestedy is a plugin to create dynamically nested fields.
## Version
```
@version 0.1.2
@since 2013-08-14
@author Washington Botelho
@documentation wbotelhos.com/nestedy
@twitter twitter.com/wbotelhos
```## Required Files
+ jquery.nestedy.js
## Options
```js
add : undefined // Callback trigged when the add button is clicked.
addButton : '.nestedy-add' // The add button element.
checkable : ['checkbox', 'radio'] // The checkable fields. This fields will be checked with checked="checked".
clone : true // If clone will copy the binds.
content : '.nestedy' // Place where the items will be copied.
excludes : ['id$="id"', 'ame$="id"', 'name$="id\\]"'] // Selectors used to exclude field of a item before clone it.
focus : ':last' // The item you want focus, you can choose `:first`, `:last` or `undefined`.
idx : /(_)\d(_)/ // Regex used to find the dynamic parte of the id of the field that will be changed.
model : '.nestedy-item' // The element inside the `content` that will be used as a model to be cloned.
namex : /(\[)\d(\])/ // Regex used to find the dynamic parte of the name of the field that will be changed.
remove : undefined // Callback trigged before an item be removed.
removeButton : '.nestedy-remove' // The class name of the remove button.
selectable : ['select-one', 'select-multiple'] // The selectable fields. This fields will be selected with selected="selected"
template : undefined // The element inside the `body` that will be used as a model to be cloned.
typeful : [ // The typeful fields.
'color',
'date',
'datetime',
'datetime-local',
'email',
'hidden',
'month',
'number',
'password',
'range',
'search',
'tel',
'text',
'textarea',
'time',
'url',
'week'
]
```## Usage without template
```html
```
```js
$('form').nestedy();
```## Usage with template
```html
```
```js
$('form').nestedy({
idx : /{index}/,
namex : /{index}/,
template : '#template'
});
```## Functions
```js
$('form').nestedy('add', 2); // Adds a number of items. Ommiting the number, 1 is de default.$('form').nestedy('remove', 3); // Removes a item. `first`, `last` or the number. Ommiting it, last is de default.
```## Licence
The MIT License
## Donate
You can do it via [PayPal](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=X8HEP2878NDEG&item_name=jQuery%20Nestedy). Thanks! (: