Hi all.

I have the following click event in JQuery and wish to duplicate it 6 times.

if($('#booking_customer_date_of_birth_1_display').length > 0)
{
$('#booking_customer_date_of_birth_1_display').click(function()
{
$(this).hide();
$('#booking_customer_date_of_birth_1_editable').show();
});
}

Replacing the number part with the number of each loop iteration i.e. booking_customer_date_of_birth_1_display becomes booking_customer_date_of_birth_2_display etc...

However have tried putting this in a for-loop but it does not work.

for($i = 2; i <= 6; i++)
{
if($('#booking_customer_date_of_birth_' + i + '_display').length > 0)
{
$('#booking_customer_date_of_birth_' + i + '_display').click(function()
{
$(this).hide();
$('#booking_customer_date_of_birth_' + i + '_editable').show();
});
}
}

Can anyone suggest how this can be done in JQuery.

Thanks.
Phil.