I have a plugin for cloning fieldsets in form. For each new fieldset, the plugin generates a new fieldset element with the same classes and subelements. In the beginning, I have only one fieldset and probably that is my problem.
I want to have a new span element in ".myClass" and in this span number, for every new +1. I have: Label Label Label
and I want to have: Label 1 Label 2 Label 3 ...
I have found jQuery code and ist working, but for each new fieldset set number 1:
$(".myClass").each(function(i) {
$(this).append($("<span>"+(i+1)+"</span>"));
});
I think the problem is because I have only one fieldset in the beginning. When I click and clone a new filedset, jQuery sees the same element.
Any solution/hint/help?