forked from DubFriend/jquery.repeater
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.pre.html
74 lines (71 loc) · 2.15 KB
/
index.pre.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Repeater</title>
<title>jquery.repeater</title>
<style>
html, body {
font-family: Helvetica, Arial, sans-serif;
color: rgb(80, 80, 80);
}
</style>
</head>
<body>
<h2>Repeater</h2>
<!-- @include repeater.html -->
<h2>Nested</h2>
<!-- @include nested-repeater.html -->
<script src="jquery-1.11.1.js"></script>
<script src="jquery.repeater.js"></script>
<script>
$(document).ready(function () {
'use strict';
$('.repeater').repeater({
defaultValues: {
'textarea-input': 'foo',
'text-input': 'bar',
'select-input': 'B',
'checkbox-input': ['A', 'B'],
'radio-input': 'B'
},
show: function () {
$(this).slideDown();
},
hide: function (deleteElement) {
if(confirm('Are you sure you want to delete this element?')) {
$(this).slideUp(deleteElement);
}
},
ready: function (setIndexes) {
}
});
window.outerRepeater = $('.outer-repeater').repeater({
isFirstItemUndeletable: true,
defaultValues: { 'text-input': 'outer-default' },
show: function () {
console.log('outer show');
$(this).slideDown();
},
hide: function (deleteElement) {
console.log('outer delete');
$(this).slideUp(deleteElement);
},
repeaters: [{
isFirstItemUndeletable: true,
selector: '.inner-repeater',
defaultValues: { 'inner-text-input': 'inner-default' },
show: function () {
console.log('inner show');
$(this).slideDown();
},
hide: function (deleteElement) {
console.log('inner delete');
$(this).slideUp(deleteElement);
}
}]
});
});
</script>
</body>
</html>