DubFriend / jquery.repeater

Create a repeatable group of input elements
MIT License
389 stars 191 forks source link

Pre-fill a few lines, and use the repeat button to create more lines #101

Closed rudddy closed 5 years ago

rudddy commented 5 years ago

I would like to be able to pre-fill a few lines from my database, and use the repeat button to create more lines. Only by clicking on the button, the form is always filled with the data from the first line when I would like to have it empty.

The code is available here: https://jsfiddle.net/vq1wLxs3/

Thanks

rudddy commented 5 years ago

I got it with

` $('.repeater').repeater({

                // (Optional)

                // "defaultValues" sets the values of added items.  The keys of

                // defaultValues refer to the value of the input's name attribute.

                // If a default value is not specified for an input, then it will

                // have its value cleared.

                defaultValues: {

                    'name1': '',

                                            'name2': ''

                }

            });

`