i have a input field and a submission button like so
<label for="name" class="col-sm-2 col-form-label">name</label>
<input type="text" class="form-control" id="name" data-belongsto="<?php echo $id; ?>" value="<?php echo $name; ?>">
<button type="button" class="update_record btn btn-primary mb-3 mt-2" id="<?php $id; ?>">Update</button>
and i have the script like so
/*Document Ready */
$(document).ready(function () {
$(document).on('click', '.update_record', function() {
let btnId= $(this).attr("id");
let name = //store name value if id == "name" and data-belongsto == btnId
});
});
what i want to do is to get the name value out and store it in a variable if id == "name" and data-belongsto == btnId