我有多个带有加号链接的表。我想使用诸如th:data-之类的自定义属性来跟踪单击哪个表的链接,以便我可以基于单击哪个链接为模态中的信息创建开关盒。
因此,每个表的加号链接看起来都是这样,但是具有不同的data-btnName值。
<th th:if="${role.isCarrierAdmin}" class="text-right"><a th:data-btnName="Commercial" class="trigger-add-contact btn btn-default" id="addCommercialContact" name="addCommercialContact"><span class="fa fa-plus"></span></a></th>
我不确定如何获取开关盒的链接数据属性……有人可以建议吗?
会是这样吗?
<div th:switch="${data-btnName}=='Commercial'">
<div th:case="true" class="row"> show this code here </div>
<div th:case="false" class="row"> or show this code here </div>
</div>