作者:coldwellmcnealey_242 | 来源:互联网 | 2023-05-17 17:04
Ihaveafunctionthatfindslinktagsandcallclickfunctiononeachlink.Iwanttocallanother
I have a function that finds link tags and call click function on each link. I want to call another function(SecondFunction) after click function has been completed. But 2nd function gets called before click function is completed. I want 2nd function to be called after a link has been clicked so function is called on that next clicked page.
我有一个功能,可以在每个链接上找到链接标记和调用点击功能。我想在点击功能完成后调用另一个函数(SecondFunction)。但是在点击功能完成之前调用第二个函数。我希望在单击链接后调用第二个函数,以便在下一个单击的页面上调用该函数。
setInterval(function(){
$TabLinks= Get all links
$TabLinks.each(function(index, value){
$(this).click(); // Do not worry about syntax, Click on first link(tab), then after clicking on tab,
I want SecondFunction() to be called
LinkClicked = 1
SecondFunction() // This function should be called when it is on clicked page.
},1500)
function SecondFunction(){
do bunch of other clicking.
setInterval(function(){
},1000)
}
Right now, it goes to first function, goes to click function but it does not go to next tab which means click function is not finished. Before going to next tab, it goes to SecondFunction() function and start running that function before click() function is finished.
现在,它转到第一个功能,转到点击功能但它没有进入下一个标签,这意味着点击功能没有完成。在转到下一个选项卡之前,它转到SecondFunction()函数并在click()函数完成之前开始运行该函数。
2 个解决方案