【发布时间】:2017-03-08 12:33:57
【问题描述】:
如何根据按下的链接更改模态框的视频和标题?
我要根据点击的链接更改的src在这里。
<iframe width="853" height="480" src=" Link's URL here " allowfullscreen></iframe>
标题在这里。
<h4 class="modal-title" id="tutorial-modal"> Link's title here </h4>
按钮是这样写的。
<a href="#" data-toggle="modal" data-target="#tutorial-modal" data-title=" The title for this link " data-video=" URL For the video for this link ">
我正在尝试使用 data-title=" " 和 data-video=" " 并分别用这些替换模态的标题和 iframe src=" "。谢谢!
我的页面上有多个模态,各不相同,我只想根据点击的链接更改 tutorial-modal 上的内容。
【问题讨论】:
-
尝试使用 jquery .attr() 来获取和设置元素的属性。
标签: javascript jquery html twitter-bootstrap