Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
3
Reply
Wait until another thread is working in jQuery
Mehul Prajapati
Jan 2 2018 12:38 AM
144
Reply
Here, I am waiting for html button element from the popup iframe window. When a popup is open then my block of code will fire the click event on time and it's working fine, but my query is wanting to wait until not get button.
I have used the nested function calling with timeout thread, so when I call then work, but don't wait and go to the next task.
setPrint();
function
setPrint() {
setTimeout(
function
() {
var
btnprint =
null
;
var
frame = $(
'#WindowFadeiFrame'
).get(0).contentDocument;
var
btn = $(
'#btn'
, frame);
if
(btn.length == 0) {
btnprint ==
null
console.log(
'not found'
);
}
else
{
btn.click();
btnprint = btn;
console.log(
'found now'
);
}
if
(btnprint ==
null
) {
setPrint(); }
}, 100);
}
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
3
)
Next Recommended Forum
Array in jquery
datepicker is not showing with datetime.