Ok, I answer myself as I founded the answer, in case it can help someone: instead of $(".addanswer").click(function(event){});, put: $(".addanswer").live("click", function(){...});
On 14 août, 10:46, Felix <slay0mit...@gmail.com> wrote: > Hello, > > I have a page with a form, that represent questions and the > corresponding answers. > I defined the minimum questions, answers, and their maximum. > So I added a link in the form to add question (along with the minimum > amount of answers), and a link per question to add an answer in it. > > the "click" event for my links is like: > $(document).ready(function(){ > $(".addquestion").click(function(event){...}); > $(".addanswer").click(function(event){alert("addanswer");...});}); > > As I'm new to JQuery, the code look more like JS, but basically it > adds the html code in the corresponding divs. > > The problem is the following: > if I add a question, it also add a link to add answers to this > question, but this link does not fire the event. > > Did I miss something to add to make it work? > I mean the link in html page is exactly the same, I even tried not > changing the part with the int, it still doesn't work. > > Thank you for your answers