I\'m trying to change all the input name based on the list index of but it seems like it\'s not changing at all.
$(\'.test\').click(funct
$("li.songs").each(function(i) {
$(this).find('input').attr('name', 'song' + i);
});
You are cloning the object, so the change is done to a copy rather than the original DOM node.
Don't use clone()
and you'll be fine. Or do this:
$("li.songs input").each(function(i) {
$(this).attr('name', $(this).attr('name') + i);
});