Skip to content
Permalink
Browse files

Make subform JS more markup-agnostic

  • Loading branch information...
flack committed May 8, 2019
1 parent 59ab04a commit d1a4d0f3e4a5a234133f74d265a0a98378956095
Showing with 2 additions and 2 deletions.
  1. +2 −2 static/midcom.datamanager/subform.js
@@ -10,7 +10,7 @@ function init_subform(id, sortable) {

container.on('click', 'a.button.remove-item', function(e) {
e.preventDefault();
$(this).closest('fieldset').remove();
$(this).parent().remove();
if ( container.data('max-count') > 0
&& container.data('max-count') >= container.find('fieldset').length
&& container.find('.add-item').length === 0) {
@@ -31,7 +31,7 @@ function init_subform(id, sortable) {

if (sortable === true) {
container
.sortable({items: '> fieldset'})
.sortable({items: '> :not(.button.add-item)'})
.on('sortupdate', function() {
$($(this).find('> .ui-sortable-handle').get().reverse()).each(function(index, element) {
$('#' + $(element).attr('id') + '_score').val(index);

0 comments on commit d1a4d0f

Please sign in to comment.
You can’t perform that action at this time.