Created
April 28, 2013 18:55
-
-
Save coolhome/5477985 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var i = 0; | |
function appendRow() { | |
$('#row') | |
.clone() | |
.attr('id', '') | |
.find(':input') | |
.each(function(index) { | |
$(this).attr({ | |
'id': function(_, id) { return id + '[' + i + '_' + (index + 1) + ']' }, | |
'name': function(_, name) { return name + '[' + i + '_' + (index + 1) + ']' }, | |
}); | |
}) | |
.end() | |
.appendTo("#tblrows"); | |
i++; | |
} | |
$(function() { | |
if(i == 0) { | |
appendRow(); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment