@@ -314,7 +314,7 @@ you'll replace with a unique, incrementing number (e.g. ``task[tags][3][name]``)
314
314
315
315
.. code-block :: javascript
316
316
317
- const addFormToCollection = (e ) => {
317
+ function addFormToCollection (e ) {
318
318
const collectionHolder = document .querySelector (' .' + e .currentTarget .dataset .collectionHolderClass );
319
319
320
320
const item = document .createElement (' li' );
@@ -579,7 +579,8 @@ on the server. In order for this to work in an HTML form, you must remove
579
579
the DOM element for the collection item to be removed, before submitting
580
580
the form.
581
581
582
- First, add a "delete this tag" link to each tag form:
582
+ In the JavaScript code, add a "delete" button to each existing tag on the page.
583
+ Then, append the "add delete button" method in the function that adds the new tags:
583
584
584
585
.. code-block :: javascript
585
586
@@ -591,7 +592,7 @@ First, add a "delete this tag" link to each tag form:
591
592
592
593
// ... the rest of the block from above
593
594
594
- const addFormToCollection = (e ) => {
595
+ function addFormToCollection (e ) {
595
596
// ...
596
597
597
598
// add a delete link to the new form
@@ -602,7 +603,7 @@ The ``addTagFormDeleteLink()`` function will look something like this:
602
603
603
604
.. code-block :: javascript
604
605
605
- const addTagFormDeleteLink = (item ) => {
606
+ function addTagFormDeleteLink (item ) {
606
607
const removeFormButton = document .createElement (' button' );
607
608
removeFormButton .innerText = ' Delete this tag' ;
608
609
0 commit comments