1
I have a code where there is a form and the user can choose the number of lines by clicking on buttons that are in front of the input, there is a '+' button to add a new input and '-' to remove the current input.
Follows the code:
<div class="posicao-radioButton botoes">
<div class="input">
<input type="radio" disabled name="idade"><input type="text"
name="quest1"><a href=""><img class="img-add" title="Adicionar uma
linha" src="img/add.png"></a><a href=""><img class="img-remove"
title="Remover Linha" src="img/remove.png"></a>
</div>
</div>
these buttons are connected with jquery events which will add a line every time + is clicked.
$(function(){
$(".img-add").click(function(e){
event.preventDefault();
console.log("click");
var parente = $(this).closest(".input");
parente.clone().appendTo( ".botoes" );
})
})
but this code is only partially working, since the event works only for the first button that is created with the page and not with others. Does anyone know what is missing to run the event on all buttons that are created?
Thank you.
It worked!! Thank you ;D
– Cesar Vinicius