【发布时间】:2021-11-24 17:12:13
【问题描述】:
我正在尝试为模态视图获取“id”,这是为了更新“onclick”元素,但我没有找到方法 :(,知道如何为 boostrap 5 完成此操作, ¿ 或其他我能做到的方式?谢谢!
<tr th:each="user: ${users}">
<a data-bs-toggle="modal" th:title="active" th:id="${user.id}" th:attr="data-target='#modal-warning'+${user.id }" data-bs-target="#modal-view">inactivate</a>
<div th:fragment="modal" class="modal fade modal-warning" th:id="modal-warning+${clinicalRepresentative.id }" tabindex="-1" role="dialog" aria-labelledby="label-modal-1" >
<div class="modal-dialog">
<div class="modal-footer">
<input th:onclick="'location.href=\'/inactivate/' + (id=${clinicalRepresentative.id}) +'\''" />
<script>
$(document).ready(function() {
var id;
$('[title="active"]').click(function() {
id = $(this).attr('id');
【问题讨论】:
标签: javascript jquery bootstrap-4 modal-dialog thymeleaf