1
I have a problem: To check if the button is visible (He’s got 30 minutes to show up. But as the function varies to remove it, it can increase the time for it to appear so I think it best to use 1 second Interval), needs to set a 1 second interval:
setInterval(function() {
if ($('#botão').is(':visible')){
FUNÇÃO "X"
}
}, 1000)
Once the button was visible initiate a function "X" that removed the button in a time of 15 to 20 seconds Note: may vary and would only perform this function once.And maybe the "X cannot remove the button, then cancels the interval or sends an Alert saying that the button has not been removed".
However if I select the interval of 1 second, it is running the function "X" all the time, because the button is visible in that time of 15 to 20 seconds that the function "X" tries to remove the button
How can I make it so that I don’t run the "X" function all the time and do for example:
If the function "X" is being executed, the interval of 1 second to. And if the function does not remove the button, it cancels the interval or sends an Alert saying that the button has not been removed or returns the interval. If you can tell me what those three roles look like,.
Does anyone have any idea how I can do that? Thanks
It seems to me you should use the
setTimeout()
instead ofsetInterval()
. Explain your problem better and include the code to your question.– Leandro Angelo
But the button appears in a 30 minute time frame, I forgot to mention
– user92401