Here's some more info/options:

http://docs.jquery.com/Frequently_Asked_Questions#Why_do_my_events_stop_working_after_an_AJAX_request.3F

- Richard

On Mon, Sep 22, 2008 at 5:51 PM, Norris <[EMAIL PROTECTED]> wrote:

>
> I ran into the same thing.  Livequery will be your savior.
>
> http://brandonaaron.net/docs/livequery/
>
> On Sep 22, 4:02 pm, yanbozey <[EMAIL PROTECTED]> wrote:
> > This is a problem that I can solve with callbacks, but I dont know if
> > there is another way to do this......
> >
> > Lets say that I have this HTML....
> >
> > <div id="parent">
> >     <p>This is the first string</p>
> > </div>
> >
> > If i specify...
> >
> > $("#parent p").hover(function(){
> >             $(this).addClass("blue");
> >         }, function(){
> >             $(this).removeClass("blue");
> >
> > });
> >
> > The paragraph in the div will turn to blue when I hover over it
> > (assuming that this is what .blue does, whatever).
> >
> > Now here is my question, lets say I have a HTML doc called
> > "somepage.html" and all it has in it is...
> >
> >      <p>This is the second paragraph</p>
> >
> > if I add the code...
> >
> > $.get("somepage.html", function(data){
> >      $("#parent").append(data);
> >
> > });
> >
> > ....it will add the paragraph to the div, but this paragraph WILL NOT
> > have the hover event applied to it. I need to add the JQuery AGAIN in
> > the $.get() callback to get the second paragraph to change color when
> > the mouse hovers over it.
> >
> > Is there someway that I can apply the JQuery to the appended HTML
> > without having to recall the function?
> >
> > Thanks
>

Reply via email to