Skip to content

Commit

Permalink
Fix/improve field removal (#9)
Browse files Browse the repository at this point in the history
* Update package.json

* Update index.js
  • Loading branch information
Osvaldas Valutis authored Jun 8, 2020
1 parent 4fbe783 commit 83cdc69
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ const removeFieldsHandler = (btn) => {
nodeToDelete.parentNode.removeChild(nodeToDelete);
}
else {
const input = btn.previousElementSibling;
if(input && input.matches('input[type=hidden]')) {
const input = nodeToDelete.querySelector('input[type=hidden][name*="[_destroy]"');
if(input) {
input.value = 1;
}
nodeToDelete.style.display = 'none';
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kollegorna/cocoon-vanilla-js",
"version": "1.0.3",
"version": "1.0.4",
"description": "A vanilla JS replacement for (Rails) Cocoon's jQuery script",
"main": "index.js",
"engines": {
Expand Down

0 comments on commit 83cdc69

Please sign in to comment.