Assuming you can put ID's on the inputs:
$('#name').change(function() {
$('#firstname').val($(this).val());
});
Otherwise you'll have to select using the names:
$('input[name="name"]').change(function() {
$('input[name="firstname"]').val($(this).val());
});