forked from sugarcrm/candybean
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathremoveFromDOM.html
More file actions
42 lines (39 loc) · 981 Bytes
/
Copy pathremoveFromDOM.html
File metadata and controls
42 lines (39 loc) · 981 Bytes
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<!--
This file presents an html page with a button and a
box. On clicking the button, the box is removed or
replaced on the DOM after a delay. It is intended
to be used for testing waitConditions that need an
element to variably be on and off the DOM.
-->
<html>
<head>
<script type="text/javascript">
function toggleDOM() {
console.log("In toggle");
var p1 = document.getElementById('p1');
var parent = document.getElementById('div1');
if (p1 != null) {
parent.removeChild(p1);
}
else{
var para = document.createElement("p");
para.setAttribute('id', 'p1');
var text = document.createTextNode("This is some writing");
para.appendChild(text);
parent.appendChild(para);
}
}
</script>
</head>
<style>
.onScreen {
position: absolute; left: 50; top:50;
}
</style>
<body>
<div id='div1'>
<input type="button" id="b1" class="onScreen" onclick="setTimeout(toggleDOM,3000)"></input>
<p id='p1'>This is some writing</p>
</div>
</body>
</html>