This is my script
var newclass = 0;
jQuery("#addexperience").click(function(){
$("#expclone").clone().find("input:text").val("").end().prependTo( ".exp_clone" );
$(".ongoing").each(function(){
$(".ongoing").addClass("newclass"+newclass);
newclass++;
});
});
I am trying to clone an articular div and add a class to the clone element. but addClass is added every time
means in the first clone he added: newclass1, in the second clone he added: newclass1 newclass2; etc.
I want only newclass2 in the second clone, and newclass3 in the dash of the clone, etc.
source
share