Boot does not work in Setinterval

Asked

Viewed 51 times

0

Opa,

I have a set interval:

$(document).ready(function(){
    setInterval(function() {
        $("#loading_questions").load("include/question.php?id_question=1");
    }, 8000);
});

Inside the file Question.php I have a button with a certain class, which when triggered calls a javascript function. What I want to know is if there is some kind of lock in a setinterval when calling a javascript function by onclick or by class.

Vlw

1 answer

0

you need to reload the event after load. You can automate this by using the .on().

then replace in your script something similar to this:

$("<selector do botão>").click(function (event) { ... })
//ou
$("<selector do botão>").on("click", function (event) { ... })

by the following:

$("#loading_questions").on("click", "<selector do botão>", function (event) { ... })

Browser other questions tagged

You are not signed in. Login or sign up in order to post.