FrEaKmAn escreveu:
> $('a#addsuggest2').click(function() {
>       alert('working');
> });
> $('a#addsuggest').click(function() {
>       //alert('working');
>       $('#message').html('<a href="#" id="addsuggest2">add</a>');
> });
> <a href="addsuggest">Add</a>
> <div id="#message"></div>
>
> what is wrong? When I click on second add link (addsuggest2) nothing
> happens
>
>   
When the code

$('a#addsuggest2').click(function() {
        alert('working');
});

is executed, the "a" element with "addsuggest2" id does not exist, so 
the click event is not bound, because you are creating the element 
on-the-fly when you click "addsuggest":

$('#message').html('<a href="#" id="addsuggest2">add</a>');


Maybe the LiveQuery plugin can help you:

http://brandonaaron.net/docs/livequery/

=)

---------------------------
Carlos Antonio da Silva
Sistemas de Informação
Rio do Sul - Santa Catarina

"Não deixa de fazer algo que gosta devido à falta de tempo,
a única falta que terá, será desse tempo que infelizmente não voltará mais."

Reply via email to