javascript - 从页面正文显示数据到模态正文
问题描述
我想将来自 Body 他们的 id(name + type) 的数据显示到 Model Body。我也希望页面正文中的数据作为标签,但在模型中作为输入。我想在编辑时单击编辑按钮并打开模型在卡片中有数据来编辑它。
https://codepen.io/fadynabilofficial/pen/PobJvER
<div class="container px-4 py-5 mx-auto">
<div class="row justify-content-center">
<div class="col-lg-12">
<div class="card">
<div class="row">
<div class="col-lg-6">
<div class="row px-1">
<div class="form-group col-md-8">
<label class="form-control-label" id="name">Cheesecake With Flavor</label>
<label class="form-control-label" id="type">Chocola</label>
</div>
</div>
</div>
<div class="col-lg-3 mt-2">
<div class="row d-flex justify-content-between px-4">
</div>
<button class="btn-block btn-edit" type="button" data-toggle="modal" data-target="#exampleModal" id="submit">
Edit
</button>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Modal -->
<div class="modal fade" id="exampleModal"
tabindex="-1"
aria-labelledby="exampleModalLabel"
aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
<input id="name">
<br>
<button type="button" class="btn btn-success btn-sm" id="submit">
Submit
</button>
</div>
</div>
</div>
</div>
解决方案
推荐阅读
- java - 使用 Scanner 函数获取用户输入
- python - 订阅图像主题但不输出图像
- android - 颤动中的图层模糊
- python - 如何在我的 python Azure 函数中安全地使用 TableService 对象?
- javascript - 羽毛图标未显示在 react-data-table-component 列中
- java - 使用 Java 流添加到现有地图
- asp.net-core - 使用 OIDC 资源服务器保护 API
- python - 如何在“plt.contour”中为曲线添加图例条目?
- python - 如何重构我的代码以使用 vectorization/apply() 并替换此迭代?
- react-native - 为什么 Apollo Client cache.writeQuery 会更新整个组件并重置所有状态?