I first used append to add a new element using jQuery as such:
var $item = $("<div>")
.addClass("box");
$("#gameDiv").append($item);
I then want to be able to mouseover
this div by accessing its class:
$(document).ready(function(){
$(".box").mouseover(function(){
alert("test");
});
});
However, it doesn't seem to work. Is there any reason why I cannot access this element? And how do I rectify it?