How to autofill with same number as previous box?

i had this code

<div class="col-sm-4">
<?=
$this->Form->control('value[' . $key . '][2]', [
'label' => false,
'class' => 'form-control desktop-country',
'type' => 'text',
'placeholder' => __('Desktop'),
'value' => isset($option->value[$key][2]) ? $option->value[$key][2] : '',
]);
                            

?>
</div>
<div class="col-sm-4">
<?=
$this->Form->control('value[' . $key . '][3]', [
'label' => false,
'class' => 'form-control mobile-country',
'type' => 'text',
'placeholder' => __('Mobile / Tablet'),
'value' => isset($option->value[$key][3]) ? $option->value[$key][3] : '',
]);

?>
</div>

it will turn like this
Example of the code

the question is… how can i make the box automatically fill with any number entered from another box? example
on india on desktop side… i fill it with 3 and the mobile/tablet will be automatically filled with 3 also… can i do that?
i hope somone can help me… i already stuck with this since morning lol….
any suggestion?