-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo.html
28 lines (25 loc) · 838 Bytes
/
demo.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<html>
<head>
<title>exists.js</title>
</head>
<body>
<div id="demo">
<div class="element1"></div>
</div>
<script src="https://cdn.jsdelivr.net/gh/mathdevelop/exists.js@latest/exists.min.js"></script>
<script>
setTimeout(function() {
document.querySelector('#demo').insertAdjacentHTML('beforeend', '<div class="element2"></div>');
}, 5000);
exists('.element2').then(function() {
console.log('Element found after 5 seconds');
setTimeout(function() {
document.querySelector('#demo .element1').insertAdjacentHTML('beforeend', '<div class="element3"></div>');
}, 5000);
});
exists('.element3', '.element1').then(function() {
console.log('Element found after 10 seconds');
});
</script>
</body>
</html>