Permalink
Browse files

Moved preventDefault to the top

  • Loading branch information...
1 parent a09f92e commit 508fec19ae5adc41fb9d4d91e0196a0758ee572d @marcneuwirth committed May 1, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 django/contrib/admin/static/admin/js/inlines.js
@@ -53,6 +53,7 @@
addButton = $(this).filter(":last").next().find("a");
}
addButton.click(function(e) {
+ e.preventDefault();
var totalForms = $("#id_" + options.prefix + "-TOTAL_FORMS");
var template = $("#" + options.prefix + "-empty");
var row = template.clone(true);
@@ -86,6 +87,7 @@
}
// The delete button of each row triggers a bunch of other things
row.find("a." + options.deleteCssClass).click(function(e) {
+ e.preventDefault();
// Remove the parent form containing this button:
var row = $(this).parents("." + options.formCssClass);
row.remove();
@@ -110,13 +112,11 @@
updateElementIndex(this, options.prefix, i);
});
}
- e.preventDefault();
});
// If a post-add callback was supplied, call it with the added form:
if (options.added) {
options.added(row);
}
- e.preventDefault();
});
}
return this;

0 comments on commit 508fec1

Please sign in to comment.