All pastes #2069545 Raw Edit

Someone

public javascript v1 · immutable
#2069545 ·published 2011-05-26 17:46 UTC
rendered paste body
function copyrow() {    $("#assigned_roles tr:last").clone().find("select").each(function() {        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(){});}).end().appendTo("#assigned_roles");}