I am trying to clone a class that contains inputs and textareas, and turn their values to nothing.
var current = $(".item").last();
current.clone().insertAfter( current );
current.find('input,textarea').val('');
The problem is instead of clearing the cloned objects inputs and textareas, it clears the last class inputs and textareas before that.
Your code is modifying the current
objects, not the cloned ones. Try something like this:
var current = $(".item").last();
var cloned = current.clone();
cloned.find('input,textarea').val('');
cloned.insertAfter( current );