All pastes #2069548 Raw Edit

Someone

public javascript v1 · immutable
#2069548 ·published 2011-05-26 17:50 UTC
rendered paste body
function copyrow() {    $("#assigned_roles tr:last").clone().find("select").each(function() {var $self = $(this);        var i = $(this).attr('name').match(/[0-9]+/);        $(this).attr({'selectedIndex': '-1',                      'name' : $(this).attr('name').replace(/[0-9]+/,(parseInt(i)+1)),                      'id'   : $(this).attr('id').replace(/[0-9]+/,(parseInt(i)+1))});    }).end().find("input").each(function(){$(this).remove();}).end().find('a').each(function(){    $(this).attr('href','#');    $(this).click(function(){});}).click(function(e){e.preventDefault();$self.remove();}.end().appendTo("#assigned_roles");}