Sha256: a46ef80002c894ddab9167a5a6286673c637d5780f9ad3f024652de1bdd97aad
Contents?: true
Size: 718 Bytes
Versions: 43
Compression:
Stored size: 718 Bytes
Contents
Spotlight.onLoad(function() { $("[data-action='add-another']").on("click", function(event) { event.preventDefault(); var templateId = $(this).data('template-id'); var template = document.querySelector('#' + templateId); var clone = document.importNode(template.content, true); var count = $(this).closest('.form-group').find('[name="' + $(clone).find('[name]').attr('name') + '"]').length + 1; $(clone).find('[id]').each(function(index, el) { $(el).attr('id', $(el).attr('id') + '_' + String(count)); }); $(clone).find('[for]').each(function(index, el) { $(el).attr('for', $(el).attr('for') + '_' + String(count)); }); $(clone).insertBefore(this); }); });
Version data entries
43 entries across 43 versions & 1 rubygems