My desired effect is for a comment delete button like what Facebook has on mouseover. The parent element is inserting a new div that will be the "delete" button on mouseover, and removing it on mouseout. My problem is, when I try to mouse over the div being inserted, it just flashes and mouseover is not called. Here is my code:
$(".parent").mouseover(function() {
$(this).append("<div class=\"delete\" style=\"display:inline;width:20px;height:20px;background-color:blue;\">X</div>");
});
$(".parent").mouseout(function() {
$(this).children(":last").remove();
});
$(".delete").click(function() {
alert("hello");
});