I'm using ajax to load content into a div. The problem I'm having is after the content loads, the javascript from the header file no longer works. When the page first loads, the hover event on .game_block_saturday works fine. After the AJAX call, the hover on .game_block_saturday no longer works. There are no errors in the console.
HTML in view_hod_games.php:
<div id="result">
<div class="game_block_saturday">
<div id="roster">
Roster Text
</div>
</div>
</div>
AJAX:
ajax=AjaxCaller();
ajax.open("GET", 'https://myurl.com/view_hod_games.php/?sort=' + value + '', true);
ajax.onreadystatechange=function(){
if(ajax.readyState==4){
if(ajax.status==200){
document.getElementById('result').innerHTML = ajax.responseText;
}
}
}
ajax.send(null);
JS from header file:
$('div.game_block_saturday').hover(
function(){
$(this).find('#roster').show();
},
function(){
$(this).find('#roster').hide();
}
);