Yapapaya / jquery-cloneya

A jquery plugin to clone DOM elements
MIT License
76 stars 28 forks source link

nested elements of a clone cannot be deleted #41

Closed danderson421 closed 8 years ago

danderson421 commented 9 years ago

in your nested demo, if you add phone numbers, then clone the contact, the phone numbers in the cloned contact cannot be deleted. not related to my implementation, not working on your demo page either. Otherwise, great work... would love to have this issue resolved if possible.

gchokeen commented 9 years ago

I checked it's clearing the phone number filed on the demo

danderson421 commented 9 years ago

I checked again... it clears the phone on the original element, but not if it's cloned. The value of the input box is cleared, but the input remains.

The problem is that this value is zero on cloned elements. var cloneCount = toDelete.closest($this.elem).closestChild($this.config.cloneThis).length;

lagunawebdesign commented 9 years ago

For me 'DELETE' button doesn't work too (after cloning)... - any solution?

TheBigK commented 8 years ago

I'm looking for the solution as well. The delete button does not work when group is cloned.

actual-saurabh commented 8 years ago

@danderson421 @lagunawebdesign @TheBigK yes, this is a bug. The clones of the children of cloned elements can't be deleted. I'll need to write some unit test cases and debug this. This will take a little while.

TheBigK commented 8 years ago

@actual-saurabh - Thanks! I was pulling out my hair over this. Would really be thankful if you could fix this. I'm using it in a project that'd be super awesome if this gets fixed.

TheBigK commented 8 years ago

@Awesome. @actual-saurabh - Does this also fix the bug that children do not respect 'maximum' setting?

actual-saurabh commented 8 years ago

Yes. The problem was that it was not able to count the total number of existing sibling clones because of a bug. It always used to come to 0. That is why it wasn't getting deleted or respecting the maximum count, because it'd never reach the maximum count.

TheBigK commented 8 years ago

Can't thank you enough man. Coffee on me if we meet in Pune. That said, I really need help with a problem about applying selectors to the child items. Would really appreciate if you could help with it. I've tweeted the link to you.