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.
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info