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