Interesting Question!
I’ve never seen repeatable fields used in Widgets. Giving a full Answer would require too much work/time, so I’ll give you links to the resources I know, and hopefully you’ll make this work and share the solution with us 😉
All this examples deal with Meta Boxes, you’ll need to copy the jQuery scripts and adapt the post_meta
to the Widgets case.
-
Create more Meta Boxes as needed – WPSE Q&A
-
Repeatable Custom Fields in a Metabox – Gist
/** * Repeatable Custom Fields in a Metabox * Author: Helen Hou-Sandi * * From a bespoke system, so currently not modular - will fix soon * Note that this particular metadata is saved as one multidimensional array (serialized) */
-
Repeatable Custom Fields in a Metabox – Another Gist example, no description given. This one is quite interesting as it has the code to sort the fields.