I'm trying to remove fields from a form that are within for
. The problem is that only the first element of for is removed, the others do not work.
I think maybe you did something wrong in the function, I have no experience with jQuery. Here is the code below:
HTML:
<div id="dados">
@for($i=0; $i<3;$i++)
<span>
<input type="text" name="op1">
<a href="#" id="remover">Remover</a>
</span>
@endfor
</div>
JS:
$(document).ready(function(){
$('#remover').click(function(){
$(this).parents('span').remove();
return false;
});
)};