我有 3 个 MySQL 表:
- 配料
- 食谱
- 成分食谱
在“成分食谱”中的“添加”表单中,我想使用 jquery 动态添加更多行,但我不知道在哪里可以找到有关如何执行此操作的信息。
这是我的“添加”表格:
<div class="ingredientsRecipes form content">
<?= $this->Form->create($ingredientsRecipe) ?>
<fieldset>
<legend><?= __('Add Ingredients Recipe') ?></legend>
<?= $this->Form->control('recipe_id', ['options' => $recipes]) ?>
<div class="table-responsive">
<table>
<thead>
<tr>
<th><?= __('Amount') ?></th>
<th><?= __('Measure') ?></th>
<th><?= __('Ingredient') ?></th>
</tr>
</thead>
<tbody>
/** ===> here starts the tablerow, that i want dynamically add
<tr>
<td><?= $this->Form->control('amount', ['label'=>false]) ?></td>
<td><?= $this->Form->control('measure', ['options' => $measures, 'label'=>false]); ?></td>
<td><?= $this->Form->control('ingredient', ['options' => $ingredients, 'label'=>false]); ?></td>
</tr>
/** ===> here end the tablerow, that i want dynamically add
</tbody>
</table>
</div>
</fieldset>
<?= $this->Form->button(__('Submit')) ?>
<?= $this->Form->end() ?>
</div>
有人可以发布有关如何执行此操作的教程的链接,或者给我一个提示,我可以在哪里找到有关此的更多信息?
提前致谢