I am appending HTML into the DOM via jquery.append – my script is as follows (please excuse the crappy code)
myDiv = $("<div class='bottomright' title="+msgID+">"+msgTitle+msgContent+
"</div>").appendTo(document.body).fadeOut(0).slideDown('fast');
shown.push(msgID);
is there a different way to address either the hover or the appending (because looking at firebug, it seems the divs get in there ok, and they show up perfectly) so that I can use the hover function?
When I say I am unable to use it, I mean it actually does nothing, I have written the following and nothing happens:
$(".bottomright").hover(function(){
alert("text")
})
hovertakes two functions as arguments:the first argument is a function that is to be executed when the element gains focus from the mouse.
the second is fired when the element loses focus from the mouse.
-BUT-
since you are dynamically generating these elements, you need to use
live:livedoes not work withhover, so you are forced to do this: