Bootstrap模式弹出窗口使用按钮 [英] Bootstrap modal popup using button

查看:72
本文介绍了Bootstrap模式弹出窗口使用按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有按钮的HTML表单,当我点击按钮时会弹出模态表单但是当我把php代码放在href中时它不会弹出。请帮我。提前谢谢。



我的尝试:



这个代码显示模态弹出窗口:

Hi, I have HTML form with a button, when I click button the modal form will popup but when I put php code inside the href it will not popup. Please help me. Thank you in advance.

What I have tried:

This code show the modal popup:

<td><a href="#myModal" data-toggle="modal"><button class="btn btn-primary">Edit Record</button></a></td>





这个不显示模态弹出窗口:



This one is not show the modal popup:

<td><a href="#myModal <?php echo '?id='.$id; ?>" data-toggle="modal"><button class="btn btn-primary">Edit Record</button></a></td>

推荐答案

id; ?>data-toggle =modal>< button class =btn btn-primary>编辑记录< / button>< / a>< / td>
id; ?>" data-toggle="modal"><button class="btn btn-primary">Edit Record</button></a></td>


根据您发布的内容,我认为您可能需要更新代码以使用data属性将id传递给模态。然后使用JavaScript读取值。如下所示。< br $> b $ b

Based on what you have posted, I think you might need to update the code to use data attribute to pass the id into the modal. Then read the value using JavaScript. Something like below.

<td><a href="#myModal" data-id="<?php echo


id; ?> data-toggle = modal > < 按钮 class = btn btn-primary > 编辑记录< / button > < / a > < / td >
id; ?>" data-toggle="modal"><button class="btn btn-primary">Edit Record</button></a></td>





这里有一个例子:带有dat的bootstrap模态弹出窗口a - JSFiddle [ ^ ]



参考:

JavaScript·Bootstrap [< a href =https://getbootstrap.com/docs/3.3/javascript/target =_ blanktitle =新窗口> ^ ]


这篇关于Bootstrap模式弹出窗口使用按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆