-
Notifications
You must be signed in to change notification settings - Fork 13
/
example.html
executable file
·81 lines (79 loc) · 2.38 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
<html>
<head><title>Test</title></head>
<body>
<h1>jQuery Form Repeater Example</h1>
<h3>Example 1: Create a Group of Inputs</h3>
<div id="example1">
<div class="r-group">
<p>
<label for="vehicle_0_0" data-pattern-text="Vehicle Name +=1:">Vehicle Name 1:</label>
<input type="text" name="vehicle[0][name]" id="vehicle_0_name" data-pattern-name="vehicle[++][name]" data-pattern-id="vehicle_++_name" />
</p>
<p>
<label for="vehicle_0_0" data-pattern-text="Vehicle Type +=1:">Vehicle Type 1:</label>
<input type="text" name="vehicle[0][type]" id="vehicle_0_type" data-pattern-name="vehicle[++][type]" data-pattern-id="vehicle_++_type" />
</p>
<p>
<!-- Add a remove button for the item. If one didn't exist, it would be added to overall group -->
<button type="button" class="r-btnRemove">Remove -</button>
</p>
</div>
<button type="button" class="r-btnAdd">Add +</button>
</div>
<h4>Code:</h4>
<pre>
$('#example1').repeater({
btnAddClass: 'r-btnAdd',
btnRemoveClass: 'r-btnRemove',
groupClass: 'r-group',
minItems: 1,
maxItems: 0,
startingIndex: 0,
showMinItemsOnLoad: true,
reindexOnDelete: true,
repeatMode: 'append',
animation: null,
animationSpeed: 400,
animationEasing: 'swing',
clearValues: true
}, [
{
"vehicle[0][name]":"test",
"vehicle[0][type]":"test"
},
{
"vehicle[1][name]":"test2",
"vehicle[1][type]":"test2"
}
]);
</pre>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<script src="jquery.form-repeater.js" type="text/javascript"></script>
<script type="text/javascript">
$('#example1').repeater({
btnAddClass: 'r-btnAdd',
btnRemoveClass: 'r-btnRemove',
groupClass: 'r-group',
minItems: 1,
maxItems: 0,
startingIndex: 0,
showMinItemsOnLoad: true,
reindexOnDelete: true,
repeatMode: 'append',
animation: null,
animationSpeed: 400,
animationEasing: 'swing',
clearValues: true
}, [
{
"vehicle[0][name]":"test",
"vehicle[0][type]":"test"
},
{
"vehicle[1][name]":"test2",
"vehicle[1][type]":"test2"
}
]);
</script>
</body>
</html>