Thanks for the answer, I found the FAQ's meanwhile....

On 17 Jan., 11:12, Giovanni Battista Lenoci <gian...@gmail.com> wrote:
> paddelboot ha scritto:
>
> > Hi,
>
> > I am trying to use a click.function on a piece of code that has been
> > loaded with AJAX. I can't imagine how to do this at the moment.
>
> > Any tipps?
>
> > Thanks,
>
> > Michae
>
> You can achieve this in 3 ways.
>
> 1. With jquery 1.3 :
>
> $(document).ready(function() {
>   $("p").live("click", function(){
>      alert('this is a paragraph')
>   });
>
> });
>
> In this way every p that exist in DOM (even if added after the document
> has loaded), has a click function binded to itself.
>
> 2. If you have jquery < 1.3 you can do the same thing using the
> livequery plugin, after including it you can call
>
> $(document).ready(function() {
>   $("p").livequery("click", function(){
>      alert('this is a paragraph')
>   });
>
> });
>
> 3. If you don't want to use this way you have to bind the function to
> the element in the onsuccess function:
>
> $.ajax({
>    type: "POST",
>    url: "some.php",
>    data: "name=John&location=Boston",
>    success: function(msg){
>       $("p").click(function() {
>         alert('this is a paragraph')
>       });
>    }
>  });
>
> Now you have only to choose the method and change the "p" selector with
> your own selector.
>
> Bye
>
> --
> gianiaz.net - web solutions
> via angelo custode, 10 - 23100 sondrio (so) - italy
> +39 347 7196482

Reply via email to