Comments (3)
add .first() to the end of your selector, like this:
$('#clonedForm').triggerHandler('clone.cloneya',[$('.toclone').first()]);
from jquery-cloneya.
or better yet, use last() to clone the last clone
$('#clonedForm').triggerHandler('clone.cloneya',[$('.toclone').last()]);
from jquery-cloneya.
In these lines:
$('.customButton').on('click', function(){
$('#clonedForm').triggerHandler('clone.cloneya',[$('.toclone')]);
});
you have basically asked to clone all the clonable elements (all elements with class .toclone
). As @solarsilk has pointed, you'd have to specify the one that you want cloned. Otherwise, if you click the clone button once, you'd get one copy (total 2).
click button again, you'd get 2 X 2 = 4 copies, then 8, then 16. It'd be a nightmare. So, you either use the .first()
or .last()
modifiers for your selector or use another way to specify which particular .toclone
needs to be cloned.
from jquery-cloneya.
Related Issues (20)
- Bootstrap-Datepicker (daterange) dan Bootstrap-Timepicker HOT 1
- Nested child incrementing the parent name HOT 3
- Bootstrap date picker position not pointing exact date input field HOT 2
- Can't get my selectors to work on child clones HOT 10
- Prevent deleting HOT 1
- Deprecate and possibly remove old event names in favour of newer namespaced events
- external control not working on new clones HOT 3
- Plugin doesn't work
- Cloning .toclone element with id doesn't replace ids HOT 2
- Clone with datepicker HOT 1
- Handle jQuery event namespaces correctly
- serializeIndex max clones HOT 3
- Label attribute 'for' should also be updated to reflect the correct field ID.
- Jquery cloneYa HOT 1
- Validate
- SerializeIndex config option not working HOT 1
- Issue with SelectBox
- How to prevent clone with before_clone?
- Name index didn't change with DELETE button
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jquery-cloneya.