I want to continuously (because the content is received through AJAX) check if a input with a class name of email exists and if exists to show another input with a class name of upload and if this input exists and another input with a class name of button is clicked to do something.
I've managed to continuously check if the input with the class name of email exists and if exists to show the input with the class name of upload, but I don't know how to continue this.
Here is what I have so far:
(function(doc,found) {
var observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
var mydiv = doc.querySelector("input.email");
if(found && !mydiv){
// Was there but is gone, do something
found = false;
$('input.upload').hide();
}
if(mydiv){
// Found it, do something
found = true;
$('input.upload').show();
}
});
});
observer.observe(doc, { childList: true, subtree: true });
})(document,false);
querySelectorcalls?