The Gallery is deprecated. No new Gallery components may be submitted, and modifying existing components is disabled. For more information please read the Gallery Deprecation blog post. This is a static snapshot of the Gallery for archive purposes.
See 1 more by this user. Created: 02/16/11
Project: YUI 3
License: YUI BSD
YUI Version: 3.3.0
Free for use.
Add Remove is simple module to quickly create add/remove functionality for lists of items. Useful for quickly adding items like addresses and locations.
The add, remove and original nodes may be of any element type. The module keeps track of the nodes it has added and will remove the last node added. Passing in the animate attribute will turn fading in and out on or off.
YUI().use('gallery-add-remove', function(Y) {
Y.on("domready", function(){
var addRemove = new Y.addRemove({
addNode: Y.one('#locationAddButton'),
removeNode: Y.one('#locationRemoveButton'),
originalNode: Y.one('.locationWrapper'),
animate: true
});
addRemove.init();
});
<div class="locationWrapper" style="border: 1x solid #ccc; margin: 20px;">
<div>Location Address: <input type="text"></div>
<div>Location Phone: <input type="text"></div>
</div>
<button type="button" id="locationAddButton">Add</button>
<button type="button" id="locationRemoveButton">Remove</button>
No forum posts for this module.
All code on this site is licensed under the BSD License unless stated otherwise.