-
Notifications
You must be signed in to change notification settings - Fork 6
/
example.html
131 lines (109 loc) · 4.5 KB
/
example.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<!doctype html>
<html lang="en-US" dir="ltr">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>addel Example</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body>
<div class="container" style="max-width: 1000px">
<div class="row">
<div class="col-sm-5">
<form class="addel"
data-addel-hide="true"
data-addel-add="3"
data-addel-animation-duration="1000">
<h2>
Organizations
<small>
data-attributes
</small>
</h2>
<div class="form-group" data-addel-target>
<label for="contact" class="control-label">
Organization
</label>
<div class="input-group">
<input type="text" id="contact" name="contacts[]" class="form-control">
<span class="input-group-btn">
<button type="button" class="btn btn-danger" data-addel-delete>
<i class="fa fa-remove"></i>
</button>
</span>
</div>
</div>
<div class="row">
<div class="form-group col-sm-4">
<button type="button" class="btn btn-success btn-block" data-addel-add="1">
<i class="fa fa-plus"></i>
</button>
</div>
<div class="form-group col-sm-4">
<button type="button" class="btn btn-success btn-block" data-addel-add="2">
<i class="fa fa-plus"></i> 2
</button>
</div>
<div class="form-group col-sm-4">
<button type="button" class="btn btn-success btn-block" data-addel-add>
<i class="fa fa-plus"></i> 3
</button>
</div>
</div>
</form>
</div>
<div class="col-sm-5 col-sm-offset-2">
<form class="addel">
<h2>
People
<small>
Traditional options
</small>
</h2>
<div class="form-group addel-target">
<label for="person" class="control-label">
Person
</label>
<div class="input-group">
<input type="text" id="person" name="contacts[]" class="form-control">
<span class="input-group-btn">
<button type="button" class="btn btn-danger addel-delete">
<i class="fa fa-remove">
</i>
</button>
</span>
</div>
</div>
<div class="form-group">
<button type="button" class="btn btn-success btn-block addel-add">
<i class="fa fa-plus"></i>
</button>
</div>
</form>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.2.1.min.js"
integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
crossorigin="anonymous"></script>
<script src="addel.jquery.js"></script>
<script>
$(document).ready(function () {
$('.addel').addel({
events: {
added: function (event) {
console.log('Added ' + event.added.length);
}
}
}).on('addel:delete', function (event) {
if (!window.confirm('Are you absolutely positive you would like to delete: ' + '"' + event.target.find(':input').val() + '"?')) {
console.log('Deletion prevented!');
event.preventDefault();
}
});
});
</script>
</body>
</html>