Hi Guillaume,
This JavaScript will work to fit your criteria. However, there are some other items that aren't accounted for in this solution. If you automate adding collection rows, it would also make sense to automate removing them. This process(removing rows) would much more difficult to code, as the new rows will not exist on page load. It would also require identifying which row was deleted from Collection A, and ensuring that the appropriate corresponding row in Collection B is removed.
Depending on the use case for this functionality, I would recommend considering ways to capture this data in a table instead. This would tie the values together better, without requiring a lengthy javascript function.
As for the solution, this javascript will fit your criteria, but will need to be updated with the appropriate collection IDs:
$(document).ready(function() {
$('#q6 > a').hide();
function addRow() {
$('#q6 > a').trigger('click');
$('#q6 > a').hide();
}
$('#q1 > a').on('click', addRow);
});
#q1 should be replaced with the ID for collection A, and #q6 should be replaced with the ID for collection B.
I hope this helps!
-Eric