Advertisement
Gorman

Untitled

Feb 24th, 2012
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function buildId(id) {
  2.   return 'data[Experience][' + id + '][experience_content]';
  3. }
  4.  
  5. jQuery('#foo').click((function () {
  6.   var i = 0;
  7.   return function () {
  8.     var $target = jQuery(buildId(i));
  9.     $target
  10.       .clone()
  11.       .attr('id', buildId(i + 1))
  12.       .insertAfter($target);
  13.     i = i + 1;
  14.   };
  15. })());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement