I have a table and the body is using foreach loop.
<?php foreach ($list as $test) : ?>
<tr>
<td>
<?= form_open_multipart('/test/update/' . $test['id'], ['class' => 'needs-validation', 'novalidate' => '']); ?>
<?= form_dropdown(
'something',
$option,
$test['smt'],
['required' => '', 'id' => 'smt2', 'class' => 'd-block col-12 form-control']
); ?>
</td>
<td align="right"><button class="btn btn-success btn-sm" type="submit" id="submit" disabled>SAVE UPDATE</a></td>
<?= form_close(); ?>
</tr>
<?php endforeach; ?>
For the javascript I do :
$(document).ready(function() {
$('select').on('change', function() {
$('button').attr('disabled', false);
});
});
When user change the value of the drop down, then the 'Save Update' button will be enabled. For now, all the button will be enabled if user change on any drop down no matter in which row. I wish to enabled only Save button in which row the drop down was changed.