1

I have a button that is generated dynamically and I want to get the click event in this button.

So, I coded this:

$(document).ready(function(){
    $('#editDescription').livequery('click',function(){
        alert('click');
    });
});

But it did not work.

So, I try the following to see if the element is seen by the JS:

$(document).ready(function(){
    $('body').livequery('click',function(){
        console.log($('#editDescription'));
    });
});

And it worked, the element was there. So I did that:

$(document).ready(function(){
    $('body').livequery('click',function(){
        $('#editDescription').livequery('click',function(){
            alert('click');
        });
    });
});

And after the second click, started to alert. Why this happens and what can I do to correct this?

Thanks!

Frias
  • 10,991
  • 9
  • 33
  • 40

0 Answers0