After the foreach number is changed, how can I import the value if I choose to be editable in the same account?

<?foreach ($region_get_all->regions as $key):?>
    // 
<?endforeach;?>

suppose I get multiple numbers via foreach
what I want to do is that when the user selects the "edit" data
, I will show the div
that there will be data

, and will automatically enter it into the account

.
// foreach
<button
 data-id="<id>"
 type="button" class="openRightLayout"></button>

// js
$(".openRightLayout").click(function(e) {
  e.preventDefault();
    var id = e.currentTarget.dataset.id;
  $("-sharpservice_range").val(id);
});

// divinput:service_range
<div>
<input id="service_range" name="service_range" type="text" value="">
</div>

he can"t do it like this. He didn"t really put the value into input.

.

Are all the elements in

foreach rendered dynamically? So button didn't exist in the first place?
then your code:

$(".openRightLayout").click(function(e) {
  e.preventDefault();
    var id = e.currentTarget.dataset.id;
  $("-sharpservice_range").val(id);
});

in fact, there is no guarantee that the event is successful, is it? What about the trial event commission?

$('body').on('click','.openRightLayout',function(){})
Menu