I know a little jQuery, but I'm not very good at 'real' JavaScript. I would like to make the following lines a lot simpler:
$('.product tr:nth-child(2) .knop',window.parent.document).bind("click", function(){
$('#edit-submitted-data-cursus').val($('.product tr:nth-child(2) .cursus a',window.parent.document).html())
$('#edit-submitted-data-cursusdatum').val($('.product tr:nth-child(2) .datum',window.parent.document).html())
$('#edit-submitted-data-opleidingscode').val($('.product tr:nth-child(2) .code',window.parent.document).html())
$('#edit-submitted-data-cursuslocatie').val($('.product tr:nth-child(2) .loc',window.parent.document).html())
$('#edit-submitted-data-cursustarief').val($('.product tr:nth-child(2) .tarief',window.parent.document).html())
});
$('.product tr:nth-child(3) .knop',window.parent.document).bind("click", function(){
$('#edit-submitted-data-cursus').val($('.product tr:nth-child(3) .cursus a',window.parent.document).html())
$('#edit-submitted-data-cursusdatum').val($('.product tr:nth-child(3) .datum',window.parent.document).html())
$('#edit-submitted-data-opleidingscode').val($('.product tr:nth-child(3) .code',window.parent.document).html())
$('#edit-submitted-data-cursuslocatie').val($('.product tr:nth-child(3) .loc',window.parent.document).html())
$('#edit-submitted-data-cursustarief').val($('.product tr:nth-child(3) .tarief',window.parent.document).html())
});
$('.product tr:nth-child(4) .knop',window.parent.document).bind("click", function(){
$('#edit-submitted-data-cursus').val($('.product tr:nth-child(4) .cursus a',window.parent.document).html())
$('#edit-submitted-data-cursusdatum').val($('.product tr:nth-child(4) .datum',window.parent.document).html())
$('#edit-submitted-data-opleidingscode').val($('.product tr:nth-child(4) .code',window.parent.document).html())
$('#edit-submitted-data-cursuslocatie').val($('.product tr:nth-child(4) .loc',window.parent.document).html())
$('#edit-submitted-data-cursustarief').val($('.product tr:nth-child(4) .tarief',window.parent.document).html())
});
,etc,etc (I have now 30 of these blocks of code. I am sure there is a way to get rid of all this redundant code, but I did not succeed yet. I am using this code to populate fields in a form. Help is much appreciated!