Repeat is for filling out mock-ups, making it easy to duplicate blocks of sample content.
That's it. See the demo, then view the source to see what I mean.
You can grab the code over at GitHub, if you get it, otherwise you'll need to read on.
Ok, but why?
The main use is duplicating sample content in templates, examples, prototypes and demo pages but without needing a server or maintaining a mess of copy-pasted HTML.
Other uses include mocking UI actions that add content, such as dummying pagination or faking infinite loading content.
It's simple but I do this so often when prototyping front-ends, I wrapped it in a single function.
Usage
$(<selector>).repeat(n [, target, deepClone])
Where: n
is the number of times to repeat the selection target
(optional) where to append the clones, otherwise appends to parents deepClone
(optional) whether to perform a deep clone, default is false
Every selected element is then cloned n
times and inserted into to their respective parent(s) after the last element in the selection, or target
if specified
Returns: the newly generated clones (in case you need to bind them or something)
Grab it
You can seen an example and get the code over at GitHub.