Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3e8aa59

Browse filesBrowse files
committed
minor #4376 Cleaned up javascript code (flip111)
This PR was squashed before being merged into the 2.3 branch (closes #4376). Discussion ---------- Cleaned up javascript code | Q | A | ------------- | --- | Doc fix? | yes | New docs? | no | Applies to | 2.3 | Fixed tickets | n/a 1. Reused variable `emailList` which is best practice and easier to read 2. Removed `return false`. There is no use for it in this context and many consider it to be bad use as well. For example: http://fuelyourcoding.com/jquery-events-stop-misusing-return-false/ Commits ------- 8931249 Cleaned up javascript code
2 parents 06e7c5f + 8931249 commit 3e8aa59
Copy full SHA for 3e8aa59

File tree

Expand file treeCollapse file tree

1 file changed

+4
-4
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-4
lines changed

‎reference/forms/types/collection.rst

Copy file name to clipboardExpand all lines: reference/forms/types/collection.rst
+4-4Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.