$(document).ready
, I send an AJAX request to a PHP page that generates a table that I put in my body, but, ... below that ajax request, I have functions that handle events of this table, as hover
in line, click the button that is in the generated table, and so on ..), but the functions these related to the table are not working, the code is OK, without syntax errors. >
I want to know if, because the table dynamically generates, when I associate events to it, it may be that events are not assigned because it has not yet been generated or something like this?
Ajax request code:
$(document).ready(function(){
$(function attform() {
$(".table").find("tbody").empty();
$.ajax({
url:"action/action.php",
method:"POST",
data:{acao:"attform"},
success: function(data){
$("tbody").append(data);
}
}); // fim ajax
}); // fim attform()
});
</script>
Soon after it, I have a js.js document that basically has functions like this:
$(document).ready(function () {
$(".modificar").hover(
function () {
these = $(this);
$(these).parent().css("background-color", "blue");
},
function () {
$(these).parent().css("background-color", "white");
});
});
See, $(".modificar")
, is a class of a button that will be dynamically generated by the ajax request I made up there ..