I have a command that get data in mysql with php and have the follow command to remove a div (can have multiples removes):
echo "<div id='".$experience['index_of_form']."'>";
echo "<a href='#remove' id='remove' name='".$experience['index_of_form']."' style='text-align: right; text-decoration: underline;'>Remove</a>
echo "</div>";
When I see the output the name is experience1 (example), or experience2. So far so good.
To remove I have this jquery function:
$('#remove').live("click", function() {
var name_of_experience = $('#remove').attr("name");
$('#'+name_of_experience+'').remove();
});
The problem is if I have a remove link with name experience2 he will remove the div with the name experience1! I dont know why, because when I see in the output, the name of the link is experience2 and not experience1.
I would guess it has to do with you assigning the same
IDto each element.ID‘s are only to be used once; switch theIDwith aCLASSand it should work just fine.