Appending then hover

Appending then hover

Hi, forgive me that I don't have my actual code, but I'm away from my computer and am posting from my iPhone.

Anyway, I'm doing something like this, and can't get the hover to work:

$('#parent').append('<div id="child"></div>');

$('#child').hover(function() {$(this).html('hello')}, function() {$(this).html('')});

The 'append' is actually triggered by a button press, so the #child isn't presnt until after the user does something. Is there anything fundamentally wrong with what I'm doing? Is it ok to assign a function to an ID before it's present?

Thanks for the help!