Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
183 changes: 94 additions & 89 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,104 +5,109 @@
<title>Repeater</title>
<title>jquery.repeater</title>
<style>
html, body {
font-family: Helvetica, Arial, sans-serif;
color: rgb(80, 80, 80);
}
html, body {
font-family: Helvetica, Arial, sans-serif;
color: rgb(80, 80, 80);
}
</style>
</head>
<body>
<h2>Repeater</h2>
<form action="echo.php" class="repeater" enctype="multipart/form-data">
<div data-repeater-list="group-a">
<div data-repeater-item>
<input name="untyped-input" value="A"/>

<input type="text" name="text-input" value="A"/>

<input type="date" name="date-input"/>

<textarea name="textarea-input">A</textarea>

<input type="radio" name="radio-input" value="A" checked/>
<input type="radio" name="radio-input" value="B"/>

<input type="checkbox" name="checkbox-input" value="A" checked/>
<input type="checkbox" name="checkbox-input" value="B"/>

<select name="select-input">
<option value="A" selected>A</option>
<option value="B">B</option>
</select>

<select name="multiple-select-input" multiple>
<option value="A" selected>A</option>
<option value="B" selected>B</option>
</select>

<input data-repeater-delete type="button" value="Delete"/>
</div>
<div data-repeater-item>
<input name="untyped-input" value="A"/>

<input type="text" name="text-input" value="B"/>

<input type="date" name="date-input"/>

<textarea name="textarea-input">B</textarea>

<input type="radio" name="radio-input" value="A" />
<input type="radio" name="radio-input" value="B" checked/>

<input type="checkbox" name="checkbox-input" value="A"/>
<input type="checkbox" name="checkbox-input" value="B" checked/>

<select name="select-input">
<option value="A">A</option>
<option value="B" selected>B</option>
</select>

<select name="multiple-select-input" multiple>
<option value="A" selected>A</option>
<option value="B" selected>B</option>
</select>

<input data-repeater-delete type="button" value="Delete"/>
</div>
</div>
<input data-repeater-create type="button" value="Add"/>
</form>

<h2>Nested</h2>
<form action="echo.php" class="outer-repeater">
<div data-repeater-list="outer-group" class="outer">
<div data-repeater-item class="outer">
<input type="text" name="text-input" value="A" class="outer"/>
<input data-repeater-delete type="button" value="Delete" class="outer"/>
<div class="inner-repeater">
<div data-repeater-list="inner-group" class="inner">
<div data-repeater-item class="inner">
<input type="text" name="inner-text-input" value="B" class="inner"/>
<input data-repeater-delete type="button" value="Delete" class="inner"/>
</div>
</div>
<input data-repeater-create type="button" value="Add" class="inner"/>
<h2>Repeater</h2>
<form action="echo.php" class="repeater" enctype="multipart/form-data">
<div data-repeater-list="group-a">
<div data-repeater-item>
<input name="untyped-input" value="A"/>

<input type="text" name="text-input" value="A"/>

<input type="number" name="number-input" value="5">

<input type="date" name="date-input"/>

<textarea name="textarea-input">A</textarea>

<input type="radio" name="radio-input" value="A" checked/>
<input type="radio" name="radio-input" value="B"/>

<input type="checkbox" name="checkbox-input" value="A" checked/>
<input type="checkbox" name="checkbox-input" value="B"/>

<select name="select-input">
<option value="A" selected>A</option>
<option value="B">B</option>
</select>

<select name="multiple-select-input" multiple>
<option value="A" selected>A</option>
<option value="B" selected>B</option>
</select>

<input data-repeater-delete type="button" value="Delete"/>
</div>
<div data-repeater-item>
<input name="untyped-input" value="A"/>

<input type="text" name="text-input" value="B"/>

<input type="number" name="number-input" value="5">

<input type="date" name="date-input"/>

<textarea name="textarea-input">B</textarea>

<input type="radio" name="radio-input" value="A" />
<input type="radio" name="radio-input" value="B" checked/>

<input type="checkbox" name="checkbox-input" value="A"/>
<input type="checkbox" name="checkbox-input" value="B" checked/>

<select name="select-input">
<option value="A">A</option>
<option value="B" selected>B</option>
</select>

<select name="multiple-select-input" multiple>
<option value="A" selected>A</option>
<option value="B" selected>B</option>
</select>

<input data-repeater-delete type="button" value="Delete"/>
</div>
</div>
<input data-repeater-create type="button" value="Add"/>
</form>

<h2>Nested</h2>
<form action="echo.php" class="outer-repeater">
<div data-repeater-list="outer-group" class="outer">
<div data-repeater-item class="outer">
<input type="text" name="text-input" value="A" class="outer"/>
<input data-repeater-delete type="button" value="Delete" class="outer"/>
<div class="inner-repeater">
<div data-repeater-list="inner-group" class="inner">
<div data-repeater-item class="inner">
<input type="text" name="inner-text-input" value="B" class="inner"/>
<input data-repeater-delete type="button" value="Delete" class="inner"/>
</div>
</div>
<input data-repeater-create type="button" value="Add" class="inner"/>
</div>
<input data-repeater-create type="button" value="Add" class="outer"/>
</form>

<script src="jquery-1.11.1.js"></script>
<script src="jquery.repeater.js"></script>
<script>
</div>
</div>
<input data-repeater-create type="button" value="Add" class="outer"/>
</form>

<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',
'number-input': '5',
'select-input': 'B',
'checkbox-input': ['A', 'B'],
'radio-input': 'B'
Expand All @@ -111,7 +116,7 @@ <h2>Nested</h2>
$(this).slideDown();
},
hide: function (deleteElement) {
if(confirm('Are you sure you want to delete this element?')) {
if (confirm('Are you sure you want to delete this element?')) {
$(this).slideUp(deleteElement);
}
},
Expand All @@ -122,7 +127,7 @@ <h2>Nested</h2>

window.outerRepeater = $('.outer-repeater').repeater({
isFirstItemUndeletable: true,
defaultValues: { 'text-input': 'outer-default' },
defaultValues: {'text-input': 'outer-default'},
show: function () {
console.log('outer show');
$(this).slideDown();
Expand All @@ -134,7 +139,7 @@ <h2>Nested</h2>
repeaters: [{
isFirstItemUndeletable: true,
selector: '.inner-repeater',
defaultValues: { 'inner-text-input': 'inner-default' },
defaultValues: {'inner-text-input': 'inner-default'},
show: function () {
console.log('inner show');
$(this).slideDown();
Expand All @@ -146,6 +151,6 @@ <h2>Nested</h2>
}]
});
});
</script>
</script>
</body>
</html>
31 changes: 16 additions & 15 deletions index.pre.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,28 @@
<title>Repeater</title>
<title>jquery.repeater</title>
<style>
html, body {
font-family: Helvetica, Arial, sans-serif;
color: rgb(80, 80, 80);
}
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>
<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',
'number-input': '5',
'select-input': 'B',
'checkbox-input': ['A', 'B'],
'radio-input': 'B'
Expand All @@ -34,7 +35,7 @@ <h2>Nested</h2>
$(this).slideDown();
},
hide: function (deleteElement) {
if(confirm('Are you sure you want to delete this element?')) {
if (confirm('Are you sure you want to delete this element?')) {
$(this).slideUp(deleteElement);
}
},
Expand All @@ -45,7 +46,7 @@ <h2>Nested</h2>

window.outerRepeater = $('.outer-repeater').repeater({
isFirstItemUndeletable: true,
defaultValues: { 'text-input': 'outer-default' },
defaultValues: {'text-input': 'outer-default'},
show: function () {
console.log('outer show');
$(this).slideDown();
Expand All @@ -57,7 +58,7 @@ <h2>Nested</h2>
repeaters: [{
isFirstItemUndeletable: true,
selector: '.inner-repeater',
defaultValues: { 'inner-text-input': 'inner-default' },
defaultValues: {'inner-text-input': 'inner-default'},
show: function () {
console.log('inner show');
$(this).slideDown();
Expand All @@ -69,6 +70,6 @@ <h2>Nested</h2>
}]
});
});
</script>
</script>
</body>
</html>
Loading