Skip to content
This repository has been archived by the owner on Dec 12, 2021. It is now read-only.

#326 "removeFields" uses closest .fields, which fails without wrapper #352

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
11 changes: 9 additions & 2 deletions vendor/assets/javascripts/jquery_nested_form.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,18 @@
removeFields: function(e) {
var $link = $(e.currentTarget),
assoc = $link.data('association'); // Name of child to be removed


var target = $($link).data('target');

var hiddenField = $link.prev('input[type=hidden]');
hiddenField.val('1');

var field = $link.closest('.fields');
if (target){
var field = $link.closest($(target));
}else{
var field = $link.closest('.fields');
}

field.hide();

field
Expand Down