Skip to content

Instantly share code, notes, and snippets.

@mklabs
Created November 1, 2010 18:30
Show Gist options
  • Select an option

  • Save mklabs/658650 to your computer and use it in GitHub Desktop.

Select an option

Save mklabs/658650 to your computer and use it in GitHub Desktop.
var thingerDom = [], gizmoDom = [],
tpl = '<p><span class="%s">i am %s %i</span></p>',
tplFn = function(str, i) {
return tpl.replace(/%s/g, str).replace(/%i/g, i);
},
i;
for (i = 0; i <= 100; i++) {
thingerDom.push(tplFn('thinger', i));
gizmoDom.push(tplFn('gizmo', i));
}
$('#thinger').append(thingerDom.join(''));
$('#gizmo').append(gizmoDom.join(''));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment