-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdemo.html
44 lines (40 loc) · 1.54 KB
/
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<title>Custom Confirm</title>
<link rel="stylesheet" href="custom-confirm.css">
</head>
<body>
<h1>Demo of "CustomConfirm" aka C2 Lib</h1>
<ul>
<li>I'm going to google <a href="https://google.com">go</a></li>
<li>I'm going to yahoo <a href="https://yahoo.com">go</a></li>
<li>An amazing & imporant thing 3 <button>delete</button></li>
<li>An amazing & imporant thing 4 <button>delete</button></li>
<li>An amazing & imporant thing 5 <button>delete</button></li>
<li>An amazing & imporant thing 6 <button>delete</button></li>
</ul>
<script src="custom-confirm.js"></script>
<script>
CustomConfirm('a', function (confirmed, element) {
if (confirmed) {
// do what you want (play with target element, ajax...)
location.href = element.href;
} else {
// do something or... nothing, if you want to
}
});
CustomConfirm('button', function (confirmed, element) {
// play with the target element or anything else
if (confirmed) {
element.parentNode.remove();
} else {
var p = document.createElement('p');
p.innerHTML = 'A Wise decision has been made for LI <strong>' + element.previousSibling.textContent + '</strong>';
element.parentNode.parentNode.appendChild(p);
}
});
</script>
</body>
</html>