Skip to content

Commit 8931249

Browse files
flip111wouterj
authored andcommitted
Cleaned up javascript code
1 parent 06e7c5f commit 8931249

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

reference/forms/types/collection.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,9 @@ you need is the JavaScript:
179179
var emailCount = '{{ form.emails|length }}';
180180

181181
jQuery(document).ready(function() {
182-
jQuery('#add-another-email').click(function() {
182+
jQuery('#add-another-email').click(function(e) {
183+
e.preventDefault();
184+
183185
var emailList = jQuery('#email-fields-list');
184186

185187
// grab the prototype template
@@ -192,9 +194,7 @@ you need is the JavaScript:
192194

193195
// create a new list element and add it to the list
194196
var newLi = jQuery('<li></li>').html(newWidget);
195-
newLi.appendTo(jQuery('#email-fields-list'));
196-
197-
return false;
197+
newLi.appendTo(emailList);
198198
});
199199
})
200200
</script>

0 commit comments

Comments
 (0)