I’m making an ajax call to a server page and print the result in a div via the html method:
$(document).ready(function()
{
$.ajax
({
async:false,
type: 'GET', cache: false,
url: '..urlhere..',
success: function(data){printresult(data);}
});
});
with printresult(data):
$("thediv").html(data);
This all works but the result itself contains spans with classes. These spans should throw a simple alert when they’re hovered. I’ve implemented that too in document.ready with:
$(".spanclass").hover(function ()
{
alert('j');
});
This doesn’t work.. Is it because the result comes from ajax and the DOM doesn’t see it as a spanclass?
You should use
delegateThis is its description from jQuery