List Manager helps you with adding and removing rows in a list. The list can be made with div's or li's elements.
To initialise it:
new listManager(el[, options]);
Methods:
.add([options]);
AND
.remove(target);
AND
.removeAll();
Options:
You can change the options when using the .add([options]) method.
Events:
Tips:
This is a small script to help add buttons to add and remove a row inside a row.
var rowContent = function() {
var content = new Element('span', {'text': (new Date())}); var removeButton = new Element('a', { 'href': '#', 'class': 'listmanager-remove-row', 'html': '-', 'events': { 'click': function(el){ list.remove(document.id(el.target).getParent('.listmanager-row')); } } }); var addButton = new Element('a', { 'href': '#', 'class': 'listmanager-add-row', 'html': '+', 'events': { 'click': function(el){ list.add({ 'rowHTML': rowContent(), 'target': document.id(el.target).getParent('.listmanager-row') }); } } }); return [addButton, removeButton, content];
};
A note on comments here: These comments are moderated. No comments will show up until they are approved. Comments that are not productive (i.e. inflammatory, rude, etc) will not be approved.
Found a bug in this plugin? Please report it this repository's Github Issues.
blog comments powered by Disqus